| 76 | | while (not self.shutdown and self.stream |
|---|
| 77 | | and not self.stream.eof and self.stream.socket is not None): |
|---|
| 78 | | self.stream.loop_iter(timeout) |
|---|
| 79 | | if self.shutdown: |
|---|
| 80 | | for sess in self.irc_sessions.values(): |
|---|
| 81 | | sess.disconnect("JJIGW shutdown") |
|---|
| 82 | | threads=threading.enumerate() |
|---|
| 83 | | for th in threads: |
|---|
| 84 | | try: |
|---|
| 85 | | th.join(10*timeout) |
|---|
| 86 | | except: |
|---|
| 87 | | pass |
|---|
| 88 | | for th in threads: |
|---|
| 89 | | try: |
|---|
| 90 | | th.join(timeout) |
|---|
| 91 | | except: |
|---|
| 92 | | pass |
|---|
| 93 | | self.disconnect() |
|---|
| 94 | | self.debug("Exitting normally") |
|---|
| | 76 | try: |
|---|
| | 77 | while (not self.shutdown and self.stream |
|---|
| | 78 | and not self.stream.eof and self.stream.socket is not None): |
|---|
| | 79 | try: |
|---|
| | 80 | self.stream.loop_iter(timeout) |
|---|
| | 81 | except (KeyboardInterrupt,SystemExit,FatalStreamError,StreamError): |
|---|
| | 82 | raise |
|---|
| | 83 | except: |
|---|
| | 84 | self.print_exception() |
|---|
| | 85 | finally: |
|---|
| | 86 | if self.shutdown: |
|---|
| | 87 | for sess in self.irc_sessions.values(): |
|---|
| | 88 | sess.disconnect("JJIGW shutdown") |
|---|
| | 89 | threads=threading.enumerate() |
|---|
| | 90 | for th in threads: |
|---|
| | 91 | try: |
|---|
| | 92 | th.join(10*timeout) |
|---|
| | 93 | except: |
|---|
| | 94 | pass |
|---|
| | 95 | for th in threads: |
|---|
| | 96 | try: |
|---|
| | 97 | th.join(timeout) |
|---|
| | 98 | except: |
|---|
| | 99 | pass |
|---|
| | 100 | self.disconnect() |
|---|
| | 101 | self.debug("Exitting normally") |
|---|