Skip to content

Commit

Permalink
Merge "Initialize tcp_hold_time in the constructor of XmppChannelConfig"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Sep 3, 2015
2 parents 1ad7793 + b208293 commit cd74710
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/control-node/test/network_agent_mock.cc
Expand Up @@ -844,7 +844,6 @@ XmppChannelConfig *NetworkAgentMock::CreateXmppConfig() {
config->endpoint.port(server_port_);
config->FromAddr = hostname();
config->ToAddr = XmppDocumentMock::kControlNodeJID;
config->tcp_hold_time = 0;
return config;
}

Expand Down
6 changes: 1 addition & 5 deletions src/xmpp/xmpp_client.cc
Expand Up @@ -48,7 +48,7 @@ XmppClient::XmppClient(EventManager *evm)
TaskScheduler::GetInstance()->GetTaskId("bgp::Config"))),
deleter_(new DeleteActor(this)),
auth_enabled_(false),
tcp_hold_time_(XmppConnectionManager::kTcpHoldTime) {
tcp_hold_time_(XmppChannelConfig::kTcpHoldTime) {
}

XmppClient::XmppClient(EventManager *evm, const XmppChannelConfig *config)
Expand All @@ -61,10 +61,6 @@ XmppClient::XmppClient(EventManager *evm, const XmppChannelConfig *config)
auth_enabled_(config->auth_enabled),
tcp_hold_time_(config->tcp_hold_time) {

if ((config->tcp_hold_time == 0) || (config->tcp_hold_time > 30)) {
tcp_hold_time_ = XmppConnectionManager::kTcpHoldTime;
}

if (config->auth_enabled) {

// Get SSL context from base class and update
Expand Down
6 changes: 2 additions & 4 deletions src/xmpp/xmpp_config.cc
Expand Up @@ -11,13 +11,11 @@ using namespace boost::asio::ip;
using namespace boost::property_tree;
using namespace std;

int const XmppChannelConfig::default_server_port = 5269;
int const XmppChannelConfig::default_client_port = 5222;

XmppChannelConfig::XmppChannelConfig(bool isClient) :
ToAddr(""), FromAddr(""), NodeAddr(""), logUVE(false), auth_enabled(false),
path_to_server_cert(""), path_to_pvt_key(""),
isClient_(isClient) {
tcp_hold_time(XmppChannelConfig::kTcpHoldTime),
isClient_(isClient) {
}

int XmppChannelConfig::CompareTo(const XmppChannelConfig &rhs) const {
Expand Down
5 changes: 3 additions & 2 deletions src/xmpp/xmpp_config.h
Expand Up @@ -30,8 +30,9 @@ class XmppChannelConfig {
int tcp_hold_time;

int CompareTo(const XmppChannelConfig &rhs) const;
static int const default_client_port;
static int const default_server_port;
static int const default_client_port = 5269;
static int const default_server_port = 5222;
static int const kTcpHoldTime = 30; //in secs

bool ClientOnly() const { return isClient_; }

Expand Down
2 changes: 0 additions & 2 deletions src/xmpp/xmpp_connection_manager.h
Expand Up @@ -25,8 +25,6 @@ class XmppConnectionManager : public SslServer {
size_t GetSessionQueueSize() const;
virtual LifetimeActor *deleter() = 0;

static const int kTcpHoldTime = 30; //in secs

private:
bool DequeueSession(TcpSessionPtr tcp_session);
void WorkQueueExitCallback(bool done);
Expand Down
4 changes: 2 additions & 2 deletions src/xmpp/xmpp_server.cc
Expand Up @@ -96,7 +96,7 @@ XmppServer::XmppServer(EventManager *evm, const string &server_addr)
server_addr_(server_addr),
log_uve_(false),
auth_enabled_(false),
tcp_hold_time_(XmppConnectionManager::kTcpHoldTime),
tcp_hold_time_(XmppChannelConfig::kTcpHoldTime),
connection_queue_(TaskScheduler::GetInstance()->GetTaskId("bgp::Config"),
0, boost::bind(&XmppServer::DequeueConnection, this, _1)) {
}
Expand All @@ -110,7 +110,7 @@ XmppServer::XmppServer(EventManager *evm)
deleter_(new DeleteActor(this)),
log_uve_(false),
auth_enabled_(false),
tcp_hold_time_(XmppConnectionManager::kTcpHoldTime),
tcp_hold_time_(XmppChannelConfig::kTcpHoldTime),
connection_queue_(TaskScheduler::GetInstance()->GetTaskId("bgp::Config"),
0, boost::bind(&XmppServer::DequeueConnection, this, _1)) {
}
Expand Down

0 comments on commit cd74710

Please sign in to comment.