-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from OferMania/timeout2
Adds timeoutIntervals, which controls the variable in BasicTransport
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Adds timeoutIntervals argument. | ||
|
||
This controls the variable of same name in BasicTransport.cc | ||
|
||
From: Ofer Gill <[email protected]> | ||
--- | ||
src/BasicTransport.cc | 6 ++++++ | ||
src/OptionParser.cc | 5 +++++ | ||
src/OptionParser.h | 13 ++++++++++++- | ||
3 files changed, 23 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/BasicTransport.cc b/src/BasicTransport.cc | ||
index 5253669a..8073d8f0 100644 | ||
--- a/src/BasicTransport.cc | ||
+++ b/src/BasicTransport.cc | ||
@@ -15,6 +15,7 @@ | ||
#include <algorithm> | ||
|
||
#include "BasicTransport.h" | ||
+#include "OptionParser.h" | ||
#include "Service.h" | ||
#include "TimeTrace.h" | ||
#include "WorkerManager.h" | ||
@@ -110,6 +111,11 @@ BasicTransport::BasicTransport(Context* context, const ServiceLocator* locator, | ||
timerInterval = Cycles::fromMicroseconds(2000); | ||
nextTimeoutCheck = Cycles::rdtsc() + timerInterval; | ||
|
||
+ if ((context->options != NULL) && | ||
+ (context->options->getTimeoutIntervals() != 0)) { | ||
+ timeoutIntervals = context->options->getTimeoutIntervals(); | ||
+ } | ||
+ | ||
LOG(NOTICE, "BasicTransport parameters: maxDataPerPacket %u, " | ||
"roundTripBytes %u, grantIncrement %u, pingIntervals %d, " | ||
"timeoutIntervals %d, timerInterval %.2f ms", | ||
diff --git a/src/OptionParser.cc b/src/OptionParser.cc | ||
index 0b89f4db..ac233aac 100644 | ||
--- a/src/OptionParser.cc | ||
+++ b/src/OptionParser.cc | ||
@@ -231,6 +231,11 @@ OptionParser::setup(int argc, char* argv[]) | ||
"How long transports should wait (ms) before declaring that a " | ||
"client connection for each rpc session is dead." | ||
"0 means use transport-specific default.") | ||
+ ("timeoutIntervals", | ||
+ ProgramOptions::value<uint32_t>(&options.timeoutIntervals)-> | ||
+ default_value(0), | ||
+ "How many intervals (attempts) in an rpc session to try with the " | ||
+ "client connection before declaring that session is dead.") | ||
("dpdkPort", | ||
ProgramOptions::value<int>(&options.dpdkPort)-> | ||
default_value(-1), | ||
diff --git a/src/OptionParser.h b/src/OptionParser.h | ||
index b715995b..0bd52f97 100644 | ||
--- a/src/OptionParser.h | ||
+++ b/src/OptionParser.h | ||
@@ -48,6 +48,7 @@ class CommandLineOptions { | ||
, externalStorageLocator() | ||
, pcapFilePath() | ||
, sessionTimeout(0) | ||
+ , timeoutIntervals(0) | ||
, portTimeout(0) | ||
, clusterName() | ||
, configDir() | ||
@@ -118,6 +119,15 @@ class CommandLineOptions { | ||
return sessionTimeout; | ||
} | ||
|
||
+ /** | ||
+ * Returns the number of intervals (attempts) the transport should use | ||
+ * in an rpc session before assuming the connection has failed. | ||
+ */ | ||
+ uint32_t getTimeoutIntervals() const | ||
+ { | ||
+ return timeoutIntervals; | ||
+ } | ||
+ | ||
/** | ||
* Returns the time (in ms) after which transports should assume that | ||
* the client for the lisning port is dead. | ||
@@ -168,7 +178,8 @@ class CommandLineOptions { | ||
string externalStorageLocator; ///< See getExternalStorageLocator(). | ||
string pcapFilePath; ///< Packet log file, "" to disable. | ||
uint32_t sessionTimeout; ///< See getSessionTimeout(). | ||
- int32_t portTimeout; ///< See getSessionTimeout(). | ||
+ uint32_t timeoutIntervals; ///< See getTimeoutIntervals(). | ||
+ int32_t portTimeout; ///< See getPortTimeout(). | ||
string clusterName; ///< See getClusterName(). | ||
string configDir; ///< See getConfigDir(). | ||
int dpdkPort; ///< See getDpdkPort(). |