You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/08/29 20:05:26 UTC
svn commit: r1162923 - /thrift/trunk/lib/cpp/src/transport/TSocket.cpp
Author: bryanduxbury
Date: Mon Aug 29 18:05:26 2011
New Revision: 1162923
URL: http://svn.apache.org/viewvc?rev=1162923&view=rev
Log:
THRIFT-1302. cpp: raise an exception if send() times out in
TSocket::write()
Patch: Adam Simpkins
Modified:
thrift/trunk/lib/cpp/src/transport/TSocket.cpp
Modified: thrift/trunk/lib/cpp/src/transport/TSocket.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/transport/TSocket.cpp?rev=1162923&r1=1162922&r2=1162923&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/transport/TSocket.cpp (original)
+++ thrift/trunk/lib/cpp/src/transport/TSocket.cpp Mon Aug 29 18:05:26 2011
@@ -481,9 +481,10 @@ void TSocket::write(const uint8_t* buf,
while (sent < len) {
uint32_t b = write_partial(buf + sent, len - sent);
if (b == 0) {
- // We assume that we got 0 because send() errored with EAGAIN due to
- // lack of system resources; release the CPU for a bit.
- usleep(50);
+ // This should only happen if the timeout set with SO_SNDTIMEO expired.
+ // Raise an exception.
+ throw TTransportException(TTransportException::TIMED_OUT,
+ "send timeout expired");
}
sent += b;
}