mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-19307 converted OplogReader::tcp_timeout from int to Seconds
This commit is contained in:
parent
a23c7a22a8
commit
62ff4ee275
@ -76,6 +76,8 @@ bool replAuthenticate(DBClientBase* conn) {
|
||||
return authenticateInternalUser(conn);
|
||||
}
|
||||
|
||||
const Seconds OplogReader::kSocketTimeout(30);
|
||||
|
||||
OplogReader::OplogReader() {
|
||||
_tailingQueryOptions = QueryOption_SlaveOk;
|
||||
_tailingQueryOptions |= QueryOption_CursorTailable | QueryOption_OplogReplay;
|
||||
@ -89,7 +91,8 @@ OplogReader::OplogReader() {
|
||||
bool OplogReader::connect(const HostAndPort& host) {
|
||||
if (conn() == NULL || _host != host) {
|
||||
resetConnection();
|
||||
_conn = shared_ptr<DBClientConnection>(new DBClientConnection(false, tcp_timeout));
|
||||
_conn =
|
||||
shared_ptr<DBClientConnection>(new DBClientConnection(false, kSocketTimeout.count()));
|
||||
string errmsg;
|
||||
if (!_conn->connect(host, errmsg) ||
|
||||
(getGlobalAuthorizationManager()->isAuthEnabled() && !replAuthenticate(_conn.get()))) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "mongo/client/constants.h"
|
||||
#include "mongo/client/dbclientcursor.h"
|
||||
#include "mongo/util/net/hostandport.h"
|
||||
#include "mongo/util/time_support.h"
|
||||
|
||||
namespace mongo {
|
||||
|
||||
@ -91,7 +92,7 @@ public:
|
||||
}
|
||||
|
||||
/* SO_TIMEOUT (send/recv time out) for our DBClientConnections */
|
||||
static const int tcp_timeout = 30;
|
||||
static const Seconds kSocketTimeout;
|
||||
|
||||
/* ok to call if already connected */
|
||||
bool connect(const HostAndPort& host);
|
||||
|
@ -79,7 +79,7 @@ bool SyncSourceFeedback::_connect(OperationContext* txn, const HostAndPort& host
|
||||
return true;
|
||||
}
|
||||
log() << "setting syncSourceFeedback to " << host.toString();
|
||||
_connection.reset(new DBClientConnection(false, OplogReader::tcp_timeout));
|
||||
_connection.reset(new DBClientConnection(false, OplogReader::kSocketTimeout.count()));
|
||||
string errmsg;
|
||||
try {
|
||||
if (!_connection->connect(host, errmsg) ||
|
||||
|
Loading…
Reference in New Issue
Block a user