Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ def start_client(host, port):
s.setsockopt(socket_module.IPPROTO_TCP, socket_module.TCP_KEEPCNT, 5)
except (AttributeError, OSError):
pass # May not be available everywhere.
try:
s.setsockopt(socket_module.IPPROTO_TCP, socket_module.TCP_NODELAY, 1)
except (AttributeError, OSError):
pass # May not be available everywhere.

try:
# 10 seconds default timeout
Expand Down
16 changes: 16 additions & 0 deletions src/debugpy/_vendored/pydevd/tests_python/test_pydevd_comm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from unittest import mock

from _pydevd_bundle import pydevd_comm


def test_start_client_sets_tcp_nodelay(monkeypatch):
sock = mock.Mock()
monkeypatch.setattr(pydevd_comm, "socket", lambda *_: sock)
monkeypatch.setattr(pydevd_comm.socket_module, "getaddrinfo", lambda *_: [])

assert pydevd_comm.start_client("localhost", 5678) is sock
sock.setsockopt.assert_any_call(
pydevd_comm.socket_module.IPPROTO_TCP,
pydevd_comm.socket_module.TCP_NODELAY,
1,
)