Skip to content

Commit 91dfb48

Browse files
authored
Merge pull request #249 from schveiguy/tcpnodelay
Standard mysql uses the socket options for TCP_NODELAY and KEEPALIVE.
2 parents f226b68 + d0b8776 commit 91dfb48

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

source/mysql/connection.d

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,20 @@ package:
387387
{
388388
auto s = new PlainPhobosSocket();
389389
s.connect(new InternetAddress(host, port));
390+
s.setOption(SocketOptionLevel.TCP, SocketOption.TCP_NODELAY, true);
391+
s.setOption(SocketOptionLevel.SOCKET, SocketOption.KEEPALIVE, true);
390392
return s;
391393
}
392394

393395
static PlainVibeDSocket defaultOpenSocketVibeD(string host, ushort port)
394396
{
395397
version(Have_vibe_core)
396-
return vibe.core.net.connectTCP(host, port);
398+
{
399+
auto s = vibe.core.net.connectTCP(host, port);
400+
s.tcpNoDelay = true;
401+
s.keepAlive = true;
402+
return s;
403+
}
397404
else
398405
assert(0);
399406
}

0 commit comments

Comments
 (0)