Skip to content

Commit

Permalink
Set TCP_USER_TIMEOUT on connections to ifmap-server.
Browse files Browse the repository at this point in the history
This is required for cases where the control-node's send buffer is non-empty
and the other end becomes unreachable. Without this option, we will wait for
20 mins before giving up on the connection. During this time, the config could
change but the control-node will not get any updates since the ifmap-server is
unreachable.

Using this option and then reconnecting to a different reachable ifmap-server
solves the problem.

Note, this is not required for cases where the other end crashes since we will
get a reset in that case. This is required only for reachability problems.

Change-Id: Ie0d5c92a76d8913177e137bd0eacbc6a033119ec
Closes-Bug: #1479521
(cherry picked from commit 064379c)
  • Loading branch information
tkarwa committed Jul 30, 2015
1 parent 44cf506 commit 56e3bed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ifmap/client/ifmap_channel.cc
Expand Up @@ -773,6 +773,16 @@ void IFMapChannel::SetArcSocketOptions() {
ec.message());
}
#endif

#ifdef TCP_USER_TIMEOUT
boost::asio::detail::socket_option::integer<IPPROTO_TCP, TCP_USER_TIMEOUT>
user_timeout_option(kSessionTcpUserTimeout);
arc_socket_->next_layer().set_option(user_timeout_option, ec);
if (ec) {
IFMAP_PEER_WARN(IFMapServerConnection, "Error setting user timeout",
ec.message());
}
#endif
}

// The connection to the peer 'host_' has timed-out. Create a new entry for
Expand Down
1 change: 1 addition & 0 deletions src/ifmap/client/ifmap_channel.h
Expand Up @@ -173,6 +173,7 @@ class IFMapChannel {
static const int kSessionKeepaliveIdleTime = 30; // in seconds
static const int kSessionKeepaliveInterval = 3; // in seconds
static const int kSessionKeepaliveProbes = 5; // count
static const int kSessionTcpUserTimeout = 45000; // in milliseconds

enum ResponseState {
NONE = 0,
Expand Down

0 comments on commit 56e3bed

Please sign in to comment.