summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-03-16 11:52:55 -0400
committerEliot Horowitz <eliot@10gen.com>2011-03-16 15:54:35 -0400
commit3d083de24be208d426817cc8cc9f4f24be520609 (patch)
tree452f0d82bc205d66bf72c40396256e6eeb1e1107
parent9a1ba315af6ae621e0cbecd7dbe91399063925cd (diff)
downloadmongo-3d083de24be208d426817cc8cc9f4f24be520609.tar.gz
movving logic from .h to .cpp
-rw-r--r--util/message.cpp10
-rw-r--r--util/message.h10
2 files changed, 14 insertions, 6 deletions
diff --git a/util/message.cpp b/util/message.cpp
index 653b5628e78..16ba4c4fcaf 100644
--- a/util/message.cpp
+++ b/util/message.cpp
@@ -773,4 +773,14 @@ again:
TicketHolder connTicketHolder(DEFAULT_MAX_CONN);
+ int AbstractMessagingPort::getClientId() {
+ if ( _clientId == 0 ) {
+ int x = remotePort();
+ x = x << 16;
+ x |= ( ( 0xFF0 & (long long)this ) >> 9 ); // lowest byte in pointer often meaningless
+ _clientId = x;
+ }
+ return _clientId;
+ }
+
} // namespace mongo
diff --git a/util/message.h b/util/message.h
index 37e94334b1b..04cdc968d15 100644
--- a/util/message.h
+++ b/util/message.h
@@ -85,12 +85,10 @@ namespace mongo {
virtual HostAndPort remote() const = 0;
virtual unsigned remotePort() const = 0;
- virtual int getClientId() {
- int x = remotePort();
- x = x << 16;
- x |= ( ( 0xFF0 & (long long)this ) >> 8 ); // lowest byte in pointer often meaningless
- return x;
- }
+ virtual int getClientId();
+
+ private:
+ int _clientId;
};
class MessagingPort : public AbstractMessagingPort {