diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index cfcb9a0d61..1f97e5b30b 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -702,8 +702,11 @@ TCPEndpoint::Shutdown(int direction) if (direction == SHUT_RD || direction == SHUT_RDWR) fFlags |= FLAG_NO_RECEIVE; - if (direction == SHUT_WR || direction == SHUT_RDWR) + if (direction == SHUT_WR || direction == SHUT_RDWR) { + // TODO: That's not correct. After read/write shutting down the socket + // one should still be able to read previously arrived data. _Disconnect(false); + } return B_OK; } @@ -883,6 +886,9 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer) if ((flags & MSG_DONTWAIT) != 0 || socket->receive.timeout == 0) return B_WOULD_BLOCK; + if ((fFlags & FLAG_NO_RECEIVE) != 0) + return B_OK; + status_t status = fReceiveList.Wait(locker, timeout); if (status < B_OK) { // The Open Group base specification mentions that EINTR should be