proxy: Add a 30-second timeout for requests in-flight to upstream

It's a little more complicated than that, actually. For the various
states that involve reading from, or writing to, the upstream fd,
if the amount of time spent in that state is > 30 seconds, we reconnect
to the server and resend the request.

we also introduce a 15-second reconnect dampener to keep us from stressing
things unduly. This may need to be decreased, or turned into an exponential
backoff, at some point.
This commit is contained in:
nick
2013-06-19 16:36:19 +01:00
parent 3c56ba0af6
commit 89fd18f6f0
2 changed files with 68 additions and 12 deletions

View File

@@ -14,6 +14,12 @@
#include "prefetch.h"
#endif
/** UPSTREAM_TIMEOUT
* How long ( in ms ) to allow for upstream to respond. If it takes longer
* than this, we will cancel the current request-response to them and resubmit
*/
#define UPSTREAM_TIMEOUT 30 * 1000
struct proxier {
/* The flexnbd wrapper this proxier is attached to */
struct flexnbd* flexnbd;