From 1f76284b5972ab01d6f6ac68f96024a8066a3b59 Mon Sep 17 00:00:00 2001
From: Adam Simpkins <firstname.lastname@example.org>
Date: Fri, 16 Apr 2010 17:43:21 +0000
Subject: [PATCH 22/33] thrift: raise an exception if send() times out in
Previously, if send() timed out in TSocket::write(), it would sleep for
50 microseconds and retry. This essentially made the timeout set with
setSendTimeout() useless. Now it raises a TTransportException on
TNonblockingServer does use TSocket with the fd manually put in
non-blocking mode, and that could cause EWOULDBLOCK and EAGAIN to occur
during normal operation. However, it only uses write_partial() and
never write(), so it should be safe to have write() throw the exception.
Used the client and server in thrift/tutorial/cpp/async/sort/ to test
sending a large message to the server. I set a 100ms timeout in the
client, and verified that it correctly times out now if the server
process is stopped.
I also ran [fb unittests] to try and verify that this doesn't negatively
affect any other code.
lib/cpp/src/transport/TSocket.cpp | 7 ++++---
1 files changed, 4 insertions, 3 deletions