File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -11,23 +11,21 @@ def __init__(self, server:SocketType) -> None:
1111 self .server = server
1212 self .receive_messages ()
1313
14+ def close (self ):
15+ """log a close message and interrupt main thread"""
16+ log_message (CLIENT_LOG_FILE , 'message thread closing' )
17+ _thread .interrupt_main ()
18+
1419 def receive_messages (self ):
1520 """handles messages received from host"""
16-
17- def close ():
18- """log a close message and interrupt main thread"""
19- log_message (CLIENT_LOG_FILE , 'message thread closing' )
20- _thread .interrupt_main ()
21-
22-
2321 try :
2422 while True :#receive message
2523 msg = self .server .recv (RECEIVE_BUFFER ).decode ('utf-8' )
2624 if not msg :
2725 pass #do nothing if no message received
2826 log_message (CLIENT_LOG_FILE , f'received message: { msg } ' )
2927 if msg == 'close' :
30- close ()
28+ self . close ()
3129 break
3230 elif msg == 'begin ft' :
3331 #special case for file transfers
@@ -36,4 +34,4 @@ def close():
3634 except Exception as x :
3735 #log errors and close gracefully
3836 log_message (CLIENT_LOG_FILE , f"exception in message thread: { x } " )
39- close ()
37+ self . close ()
You can’t perform that action at this time.
0 commit comments