From: Mark Slee Date: Wed, 24 Jan 2007 23:14:30 +0000 (+0000) Subject: Thrift socket should not perror in the TRYAGAIN state X-Git-Tag: 0.2.0~1530 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=c425780847ea746a474f8c81c6e8cb350d1a4feb;p=common%2Fthrift.git Thrift socket should not perror in the TRYAGAIN state Reviewed By: wayne git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664942 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/transport/TSocket.cpp b/lib/cpp/src/transport/TSocket.cpp index e3615caf..0c3f7734 100644 --- a/lib/cpp/src/transport/TSocket.cpp +++ b/lib/cpp/src/transport/TSocket.cpp @@ -229,9 +229,7 @@ uint32_t TSocket::read(uint8_t* buf, uint32_t len) { ++g_socket_syscalls; // Check for error on read - if (got < 0) { - perror("TSocket::read()"); - + if (got < 0) { // If temporarily out of resources, sleep a bit and try again if (errno == EAGAIN && retries++ < MAX_RECV_RETRIES) { usleep(50); @@ -243,6 +241,9 @@ uint32_t TSocket::read(uint8_t* buf, uint32_t len) { goto try_again; } + // Now it's not a try again case, but a real probblez + perror("TSocket::read()"); + // If we disconnect with no linger time if (errno == ECONNRESET) { throw TTransportException(TTX_NOT_OPEN, "ECONNRESET");