From: David Reiss Date: Fri, 18 Apr 2008 17:48:03 +0000 (+0000) Subject: Thrift: bug fix for interrupting server socket X-Git-Tag: 0.2.0~814 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=2724c7a311dcab7422fd410444d89946ef759c0d;p=common%2Fthrift.git 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 1bfc56bc..cc81390f 100644 --- a/lib/cpp/src/transport/TServerSocket.cpp +++ b/lib/cpp/src/transport/TServerSocket.cpp @@ -257,7 +257,7 @@ shared_ptr 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);