tcp: allow TCP_NODELAY to be set

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21069 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-05-08 15:38:33 +00:00
parent 36880dfbed
commit a0a553caa3
3 changed files with 25 additions and 1 deletions
@@ -724,6 +724,27 @@ TCPEndpoint::SetReceiveBufferSize(size_t length)
}
status_t
TCPEndpoint::SetOption(int option, const void *_value, int length)
{
if (option != TCP_NODELAY)
return B_BAD_VALUE;
if (length != sizeof(int))
return B_BAD_VALUE;
const int *value = (const int *)_value;
RecursiveLocker _(fLock);
if (*value)
fOptions |= TCP_NODELAY;
else
fOptions &= ~TCP_NODELAY;
return B_OK;
}
// #pragma mark - misc
@@ -67,6 +67,8 @@ class TCPEndpoint : public net_protocol, public ProtocolSocket {
status_t SetSendBufferSize(size_t length);
status_t SetReceiveBufferSize(size_t length);
status_t SetOption(int option, const void *value, int length);
tcp_state State() const { return fState; }
bool IsBound() const;
@@ -489,7 +489,8 @@ tcp_setsockopt(net_protocol *_protocol, int level, int option,
if (status < B_OK)
return status;
}
}
} else if (level == IPPROTO_TCP)
return protocol->SetOption(option, _value, length);
return protocol->next->module->setsockopt(protocol->next, level, option,
_value, length);