nb: Fix polling with http.

When we call readIncomingData() outside of the poll, we read the data, and
store them into the buffer.  But then the next poll will not indicate that
there data actually some available (they've been already read from the FD),
and we will get stuck.

I susppect we should remove from the SSL case at some stage too, to be
symmetrict to the non-SSL case.

Change-Id: Ib8339400b41e797adb2eb8519f87093ebf6be9c5
This commit is contained in:
Jan Holesovsky 2017-03-06 12:38:12 +01:00
parent 1b8e6f8c78
commit 4be3ac614d

View file

@ -2316,11 +2316,7 @@ class PlainSocketFactory : public SocketFactory
{
std::shared_ptr<Socket> create(const int fd) override
{
auto socket = StreamSocket::create<StreamSocket>(fd, std::unique_ptr<SocketHandlerInterface>{ new ClientRequestDispatcher });
// Read the request.
socket->readIncomingData();
return socket;
return StreamSocket::create<StreamSocket>(fd, std::unique_ptr<SocketHandlerInterface>{ new ClientRequestDispatcher });
}
};
@ -2332,6 +2328,8 @@ class SslSocketFactory : public SocketFactory
auto socket = StreamSocket::create<SslStreamSocket>(fd, std::unique_ptr<SocketHandlerInterface>{ new ClientRequestDispatcher });
// Do the ssl handshake and read the request.
// TODO is this really necessary? This goes against how the polling &
// buffering is done in the generic / non-ssl case...
socket->readIncomingData();
return socket;
}