From 8d00b95aa9ef7544c7bb947c8c5c48bb0f2fc19d Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Thu, 5 Apr 2007 23:26:39 +0000 Subject: [PATCH] The Open Group base specification mentions that EINTR should be returned if the recv() is interrupted before _any data_ is available. So we actually check if there is data, and if so, push it to the user. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20593 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index c1c714b9e9..9e8ea00d48 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -519,9 +519,12 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer) locker.Lock(); if (status < B_OK) { - // TODO: If we are timing out, should we push the - // available data to the user? - if (status == B_TIMED_OUT && fReceiveQueue.Available() > 0) + // The Open Group base specification mentions that EINTR should be + // returned if the recv() is interrupted before _any data_ is + // available. So we actually check if there is data, and if so, + // push it to the user. + if ((status == B_TIMED_OUT || status == B_INTERRUPTED) + && fReceiveQueue.Available() > 0) break; return status; }