diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-02-01 01:01:51 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-02-01 01:08:57 -0500 |
commit | 693f98877f026c5a6e47986a13998b2984130e85 (patch) | |
tree | c9dbf751ebde36f61bee65e7f8473d3b3fb61672 /util | |
parent | 8330ff07664b1bbc1a966e5d224520872fbb245a (diff) | |
download | mongo-693f98877f026c5a6e47986a13998b2984130e85.tar.gz |
cache HostAndPort in MessagingPort
Diffstat (limited to 'util')
-rw-r--r-- | util/message.cpp | 4 | ||||
-rw-r--r-- | util/message.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/util/message.cpp b/util/message.cpp index 16bea2a8b1a..653b5628e78 100644 --- a/util/message.cpp +++ b/util/message.cpp @@ -696,7 +696,9 @@ again: } HostAndPort MessagingPort::remote() const { - return farEnd; + if ( _farEndParsed.port() == -1 ) + _farEndParsed = HostAndPort( farEnd ); + return _farEndParsed; } diff --git a/util/message.h b/util/message.h index a0b69c30728..37e94334b1b 100644 --- a/util/message.h +++ b/util/message.h @@ -152,6 +152,10 @@ namespace mongo { long long _bytesIn; long long _bytesOut; + + // this is the parsed version of farEnd + // mutable because its initialized only on call to remote() + mutable HostAndPort _farEndParsed; public: SockAddr farEnd; |