Skip to content

Commit 6e3a6ac

Browse files
authored
Merge pull request #4707 from compnerd/nagle
Process: disable Nagle on Windows
2 parents f3f3a73 + 8419393 commit 6e3a6ac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/Foundation/Process.swift

+7
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ open class Process: NSObject {
452452
return (first: INVALID_SOCKET, second: INVALID_SOCKET)
453453
}
454454

455+
var option: CInt = 1
456+
if setsockopt(first, IPPROTO_TCP.rawValue, TCP_NODELAY, &option,
457+
CInt(MemoryLayout.size(ofValue: option))) == SOCKET_ERROR {
458+
closesocket(first)
459+
return (first: INVALID_SOCKET, second: INVALID_SOCKET)
460+
}
461+
455462
let second: SOCKET = accept(listener, nil, nil)
456463
if second == INVALID_SOCKET {
457464
closesocket(first)

0 commit comments

Comments
 (0)