Skip to content

Commit

Permalink
Create TCP socket with TCP_NODELAY.
Browse files Browse the repository at this point in the history
Nagle's algorithm plays badly with delayed ACK algorithm. Fix it to make
interactive clients more responsive.
  • Loading branch information
cykerway committed Dec 30, 2018
1 parent f5e25cb commit da453ed
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mpd/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def _connect_tcp(self, host, port):
sock = None
try:
sock = socket.socket(af, socktype, proto)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
sock.settimeout(self.timeout)
sock.connect(sa)
Expand Down

0 comments on commit da453ed

Please sign in to comment.