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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user