Skip to content

Commit

Permalink
fix: socket timeout is in seconds, not in ms
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyCP committed Jun 13, 2024
1 parent 5b21b95 commit 13e0e0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/smartinspect/protocols/tcp_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def _internal_connect(self):
def _internal_initialize_socket(self) -> socket.socket:
socket_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket_.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
socket_.settimeout(self._timeout)
# settimeout argument is in seconds, smartinspect timeout option is milliseconds
# convert ms to s by dividing by 1000
# https://docs.python.org/3/library/socket.html#socket.socket.settimeout
socket_.settimeout(self._timeout / 1000)
socket_.connect((self._hostname, self._port))

return socket_
Expand Down

0 comments on commit 13e0e0e

Please sign in to comment.