@@ -697,11 +697,11 @@ def socket_write(self, socket_num, buffer, conn_mode=TCP_MODE):
697
697
print ("Writing:" , buffer )
698
698
self ._socknum_ll [0 ][0 ] = socket_num
699
699
sent = 0
700
- totalChunks = (len (buffer ) // 64 ) + 1
700
+ total_chunks = (len (buffer ) // 64 ) + 1
701
701
send_command = _SEND_DATA_TCP_CMD
702
- if conn_mode == UDP_MODE : # UDP requires a different command to write
702
+ if conn_mode == self . UDP_MODE : # UDP requires a different command to write
703
703
send_command = _INSERT_DATABUF_TCP_CMD
704
- for chunk in range (totalChunks ):
704
+ for chunk in range (total_chunks ):
705
705
resp = self ._send_command_get_response (
706
706
send_command ,
707
707
(
@@ -712,11 +712,11 @@ def socket_write(self, socket_num, buffer, conn_mode=TCP_MODE):
712
712
)
713
713
sent += resp [0 ][0 ]
714
714
715
- if conn_mode == UDP_MODE :
715
+ if conn_mode == self . UDP_MODE :
716
716
# UDP verifies chunks on write, not bytes
717
- if sent != totalChunks :
717
+ if sent != total_chunks :
718
718
raise RuntimeError (
719
- "Failed to write %d chunks (sent %d)" % (totalChunks , sent )
719
+ "Failed to write %d chunks (sent %d)" % (total_chunks , sent )
720
720
)
721
721
# UDP needs to finalize with this command, does the actual sending
722
722
resp = self ._send_command_get_response (_SEND_UDP_DATA_CMD , self ._socknum_ll )
@@ -766,10 +766,11 @@ def socket_connect(self, socket_num, dest, port, conn_mode=TCP_MODE):
766
766
print ("*** Socket connect mode" , conn_mode )
767
767
768
768
self .socket_open (socket_num , dest , port , conn_mode = conn_mode )
769
- if conn_mode == UDP_MODE :
769
+ if conn_mode == self . UDP_MODE :
770
770
# UDP doesn't actually establish a connection
771
771
# but the socket for writing is created via start_server
772
772
self .start_server (port , socket_num , conn_mode )
773
+ return True
773
774
else :
774
775
times = time .monotonic ()
775
776
while (time .monotonic () - times ) < 3 : # wait 3 seconds
0 commit comments