summaryrefslogtreecommitdiff
path: root/src/mongo/tools
diff options
context:
space:
mode:
authorMatt Cotter <matt.cotter@mongodb.com>2016-01-27 16:39:14 -0500
committerMatt Cotter <matt.cotter@mongodb.com>2016-05-20 14:06:28 -0400
commit225a2a57350c79a190c13054a038b6c3c559a558 (patch)
tree6e24efd0f62c580e1c09e17d5b5d7a561dd63e01 /src/mongo/tools
parente6e7e099aaf11afb626d2cd95dd1d339433f6e7f (diff)
downloadmongo-225a2a57350c79a190c13054a038b6c3c559a558.tar.gz
SERVER-23448 create an ASIO based MessagingPort
Diffstat (limited to 'src/mongo/tools')
-rw-r--r--src/mongo/tools/bridge.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp
index 64ff17387e0..e61fd05d9f9 100644
--- a/src/mongo/tools/bridge.cpp
+++ b/src/mongo/tools/bridge.cpp
@@ -53,6 +53,7 @@
#include "mongo/util/assert_util.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/net/abstract_message_port.h"
#include "mongo/util/net/listen.h"
#include "mongo/util/net/message.h"
#include "mongo/util/exit.h"
@@ -86,7 +87,7 @@ boost::optional<HostAndPort> extractHostInfo(const rpc::RequestInterface& reques
class Forwarder {
public:
- Forwarder(MessagingPort* mp,
+ Forwarder(AbstractMessagingPort* mp,
stdx::mutex* settingsMutex,
HostSettingsMap* settings,
int64_t seed)
@@ -114,7 +115,7 @@ public:
warning() << "Unable to establish connection to "
<< mongoBridgeGlobalParams.destUri << " after " << elapsed
<< " seconds: " << status;
- log() << "end connection " << _mp->psock->remoteString();
+ log() << "end connection " << _mp->remote().toString();
_mp->shutdown();
return;
}
@@ -132,7 +133,7 @@ public:
try {
request.reset();
if (!_mp->recv(request)) {
- log() << "end connection " << _mp->psock->remoteString();
+ log() << "end connection " << _mp->remote().toString();
_mp->shutdown();
break;
}
@@ -183,7 +184,7 @@ public:
// Close the connection to 'dest'.
case HostSettings::State::kHangUp:
log() << "Rejecting connection from " << host->toString()
- << ", end connection " << _mp->psock->remoteString();
+ << ", end connection " << _mp->remote().toString();
_mp->shutdown();
return;
// Forward the message to 'dest' with probability '1 - hostSettings.loss'.
@@ -214,7 +215,7 @@ public:
// If there's nothing to respond back to '_mp' with, then close the connection.
if (response.empty()) {
log() << "Received an empty response, end connection "
- << _mp->psock->remoteString();
+ << _mp->remote().toString();
_mp->shutdown();
break;
}
@@ -228,7 +229,7 @@ public:
// connections from 'host', then do so now.
if (hostSettings.state == HostSettings::State::kHangUp) {
log() << "Closing connection from " << host->toString()
- << ", end connection " << _mp->psock->remoteString();
+ << ", end connection " << _mp->remote().toString();
_mp->shutdown();
break;
}
@@ -259,7 +260,7 @@ public:
}
} catch (const DBException& ex) {
error() << "Caught DBException in Forwarder: " << ex << ", end connection "
- << _mp->psock->remoteString();
+ << _mp->remote().toString();
_mp->shutdown();
break;
} catch (...) {
@@ -303,7 +304,7 @@ private:
return {};
}
- MessagingPort* _mp;
+ AbstractMessagingPort* _mp;
stdx::mutex* _settingsMutex;
HostSettingsMap* _settings;
@@ -319,7 +320,7 @@ public:
log() << "Setting random seed: " << mongoBridgeGlobalParams.seed;
}
- void acceptedMP(MessagingPort* mp) final {
+ void accepted(AbstractMessagingPort* mp) override final {
{
stdx::lock_guard<stdx::mutex> lk(_portsMutex);
if (_inShutdown.load()) {
@@ -343,7 +344,7 @@ public:
private:
stdx::mutex _portsMutex;
- std::set<MessagingPort*> _ports;
+ std::set<AbstractMessagingPort*> _ports;
AtomicWord<bool> _inShutdown{false};
stdx::mutex _settingsMutex;