Skip to content

Commit

Permalink
Add TCP_KEEPALIVE_SECONDS env based option
Browse files Browse the repository at this point in the history
TCP_KEEPALIVE_SECONDS value of 0 disables tcp keepalives.

Change-Id: Iedcc06d5a8cb4b3958c23108b120ad3d15fee533
Partial-Bug: #1464016
  • Loading branch information
ananth-at-camphor-networks committed Jul 2, 2016
1 parent e18ced3 commit fed8570
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/bgp/test/bgp_stress_test.cc
Expand Up @@ -2295,11 +2295,6 @@ void BgpStressTest::AddAllRoutes(int ninstances, int npeers, int nagents,
"IFMAP configuration");
}

// Wait for subscription processing to complete
TASK_UTIL_EXPECT_NE(0, server_->membership_mgr()->total_jobs_count());
TASK_UTIL_EXPECT_EQ(0, server_->membership_mgr()->current_jobs_count());
WaitForIdle();

BGP_STRESS_TEST_LOG("Start injecting BGP and/or XMPP routes");
AddAllBgpRoutes(nroutes, ntargets);
BGP_STRESS_TEST_LOG("End injecting BGP and/or XMPP routes");
Expand Down
7 changes: 7 additions & 0 deletions src/xmpp/xmpp_session.cc
Expand Up @@ -99,6 +99,13 @@ void XmppSession::IncStats(unsigned int type, uint64_t bytes) {
}

boost::system::error_code XmppSession::EnableTcpKeepalive(int hold_time) {
char *keepalive_time_str = getenv("TCP_KEEPALIVE_SECONDS");
if (keepalive_time_str) {
hold_time = strtoul(keepalive_time_str, NULL, 0) * 3;
if (!hold_time)
return boost::system::error_code();
}

if (hold_time <= 9) {
hold_time = 9; // min hold-time in secs.
}
Expand Down

0 comments on commit fed8570

Please sign in to comment.