Skip to content

Commit 13e0e0e

Browse files
committed
fix: socket timeout is in seconds, not in ms
1 parent 5b21b95 commit 13e0e0e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/smartinspect/protocols/tcp_protocol.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ def _internal_connect(self):
143143
def _internal_initialize_socket(self) -> socket.socket:
144144
socket_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
145145
socket_.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
146-
socket_.settimeout(self._timeout)
146+
# settimeout argument is in seconds, smartinspect timeout option is milliseconds
147+
# convert ms to s by dividing by 1000
148+
# https://docs.python.org/3/library/socket.html#socket.socket.settimeout
149+
socket_.settimeout(self._timeout / 1000)
147150
socket_.connect((self._hostname, self._port))
148151

149152
return socket_

0 commit comments

Comments
 (0)