Thrift: bug fix for interrupting server socket
authorDavid Reiss <dreiss@apache.org>
Fri, 18 Apr 2008 17:48:03 +0000 (17:48 +0000)
committerDavid Reiss <dreiss@apache.org>
Fri, 18 Apr 2008 17:48:03 +0000 (17:48 +0000)
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

lib/cpp/src/transport/TServerSocket.cpp

index 1bfc56b..cc81390 100644 (file)
@@ -257,7 +257,7 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {
     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);