@@ -19,12 +19,12 @@ def get_input(self, text):
19
19
self .status_handler .input ()
20
20
self .s .sendall (text .encode ())
21
21
data = self .s .recv (CODEBYTES )
22
- logging .debug (data )
22
+ # logging.debug(data)
23
23
if not self .status_handler .is_code ("OK" , data ):
24
24
raise ConnectionError ("Client not confirming" )
25
25
26
26
data = self .s .recv (CODEBYTES )
27
- logging .debug (data )
27
+ # logging.debug(data)
28
28
if not self .status_handler .is_code ("Response" , data ):
29
29
raise ConnectionError ("Client not responding" )
30
30
data = self .s .recv (BUFFSIZENUM ).decode ().strip ()
@@ -58,20 +58,22 @@ def get_file(self, file: BinaryIO, filename):
58
58
file .write (self .s .recv (BUFFSIZENUM ))
59
59
dim -= BUFFSIZENUM
60
60
file .write (self .s .recv (dim ))
61
- logging .debug (file .tell ())
62
- logging .debug (original_dim )
63
- while file .tell () != original_dim :
64
- logging .debug (file .tell ())
65
- logging .debug (original_dim )
61
+ # logging.debug(file.tell())
62
+ # logging.debug(original_dim)
63
+ cont = 0
64
+ while file .tell () != original_dim and cont < 1000 : # Flush buffer function
65
+ # logging.debug(file.tell())
66
+ # logging.debug(original_dim)
66
67
file .write (self .s .recv (BUFFSIZENUM ))
67
- # if file.tell() != original_dim: # Size check has no meaning because file size depends on the filesystem
68
- # self.status_handler.error_file_recv_incomplete()
69
- # raise ConnectionError("FileRecvIncomplete")
70
- # else:
71
- # logging.info("File received")
72
- # self.status_handler.ok()
73
- logging .info ("File received" )
74
- self .status_handler .ok ()
68
+ cont += 1
69
+ if file .tell () != original_dim :
70
+ self .status_handler .error_file_recv_incomplete ()
71
+ raise ConnectionError ("FileRecvIncomplete" )
72
+ else :
73
+ logging .info ("File received" )
74
+ self .status_handler .ok ()
75
+ # logging.info("File received")
76
+ # self.status_handler.ok()
75
77
self .status_handler .end ()
76
78
77
79
def send_file (self , file , filename ):
0 commit comments