Fix TNonBlockingServer libevent issue in ThreadPool mode
authorMark Slee <mcslee@apache.org>
Thu, 23 Aug 2007 01:43:20 +0000 (01:43 +0000)
committerMark Slee <mcslee@apache.org>
Thu, 23 Aug 2007 01:43:20 +0000 (01:43 +0000)
commit402ee28f87dd855d8825182b79617891a7ac4b93
tree575a3efb8fc18c8ee41185bd61be23c5ba29b13a
parent25b5ee3285d9230fcda9ec30ca99db306906ae89
Fix TNonBlockingServer libevent issue in ThreadPool mode

Summary: If using TNonBlockingServer with a ThreadManager, when you send a task off to the threadmanager you need to cancel the event that you have set on that client socket. Otherwise, when you give control back to libevent, it might trigger more read events if there are more requests coming down the pipe. This is an issue, because the server will be in the wrong state at that point and will have no way of handling reading more data if it is still in the WAIT_TASK state trying to see if it should write something back to the client. So, when we hit that control flow, we must setIdle() on the TConnection so that libevent doesn't trigger it anymore. Later, after the result is written, we'll setRead() and go back to the init state.

Reviewed By: akhil

Test Plan: Akhil's async + TNonBlocking karma server

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665217 13f79535-47bb-0310-9956-ffa450edef68
lib/cpp/src/server/TNonblockingServer.cpp
lib/cpp/src/server/TNonblockingServer.h