Repository: thrift Updated Branches: refs/heads/master 7edc8faef -> 4194562c6
THRIFT-4038 socket check: checking an unsigned number against >= 0 never fails Client: C++ Patch: gzshi <[email protected]> This closes #1153 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4194562c Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4194562c Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4194562c Branch: refs/heads/master Commit: 4194562c60efd101f278c2aa76ce53a53e5382a8 Parents: 7edc8fa Author: gzshi <[email protected]> Authored: Fri Jan 6 10:47:03 2017 +0800 Committer: Jens Geyer <[email protected]> Committed: Sun Jan 22 13:23:28 2017 +0100 ---------------------------------------------------------------------- lib/cpp/src/thrift/server/TNonblockingServer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/4194562c/lib/cpp/src/thrift/server/TNonblockingServer.cpp ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp index 537770b..649910f 100644 --- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp +++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp @@ -1321,7 +1321,7 @@ TNonblockingIOThread::~TNonblockingIOThread() { ownEventBase_ = false; } - if (listenSocket_ >= 0) { + if (listenSocket_ != THRIFT_INVALID_SOCKET) { if (0 != ::THRIFT_CLOSESOCKET(listenSocket_)) { GlobalOutput.perror("TNonblockingIOThread listenSocket_ close(): ", THRIFT_GET_SOCKET_ERROR); } @@ -1387,7 +1387,7 @@ void TNonblockingIOThread::registerEvents() { event_base_get_method(eventBase_)); } - if (listenSocket_ >= 0) { + if (listenSocket_ != THRIFT_INVALID_SOCKET) { // Register the server event event_set(&serverEvent_, listenSocket_, @@ -1590,7 +1590,7 @@ void TNonblockingIOThread::run() { void TNonblockingIOThread::cleanupEvents() { // stop the listen socket, if any - if (listenSocket_ >= 0) { + if (listenSocket_ != THRIFT_INVALID_SOCKET) { if (event_del(&serverEvent_) == -1) { GlobalOutput.perror("TNonblockingIOThread::stop() event_del: ", THRIFT_GET_SOCKET_ERROR); }
