Thrift: bug fix for interrupting server socket
Summary: TServerSocket uses a socket pair to signal interruption to the select() call on its main server socket. A bug in the code prevented the select() from listening for events on the internal socket pair; in fact, it was accidentally listening to file descriptor 1.
Reviewed By: aditya
Test Plan: Use a server that supports a call to shutdown, which should signal an interrupt to the internal socket, and should result in an immediate and clean termination of the server socket thread.
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 11932
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665658 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TServerSocket.cpp b/lib/cpp/src/transport/TServerSocket.cpp
index 1bfc56b..cc81390 100644
--- a/lib/cpp/src/transport/TServerSocket.cpp
+++ b/lib/cpp/src/transport/TServerSocket.cpp
@@ -257,7 +257,7 @@
fds[0].events = POLLIN;
if (intSock2_ >= 0) {
fds[1].fd = intSock2_;
- fds[1].fd = POLLIN;
+ fds[1].events = POLLIN;
}
int ret = poll(fds, 2, -1);