mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2025-02-27 17:22:01 +01:00
Add an 'exception' attribute to Connection objects recording the reason for termination of the networking thread.
This commit is contained in:
parent
626b765094
commit
f1391ab29b
@ -149,7 +149,6 @@ class Connection(object):
|
||||
|
||||
self.write_packet(handshake)
|
||||
|
||||
|
||||
class NetworkingThread(threading.Thread):
|
||||
interrupt = False
|
||||
|
||||
@ -160,6 +159,12 @@ class NetworkingThread(threading.Thread):
|
||||
self.daemon = True
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self._run()
|
||||
except Exception as e:
|
||||
self.connection.exception = e
|
||||
|
||||
def _run(self):
|
||||
while True:
|
||||
if self.interrupt:
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user