Fix port forwarding and EINVAL on Unix

This commit is contained in:
Jeffrey Walton 2016-10-10 19:50:45 -04:00
parent 2d8992a547
commit bc5ae1b7c1
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

View File

@ -825,7 +825,8 @@ void ForwardTcpPort(const char *sourcePortName, const char *destinationHost, con
sockListen.Create();
sockListen.Bind(sourcePort);
int err = setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY, "\x01", 1);
const int flag = 1;
int err = setsockopt(sockListen, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int));
CRYPTOPP_ASSERT(err == 0);
if(err != 0)
throw Socket::Err(sockListen, "setsockopt", sockListen.GetLastError());