diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2014-07-31 16:42:21 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-08-08 16:25:52 -0400 |
commit | daab6fae496e1aca6b8f7c709bd18307745df1dd (patch) | |
tree | ecfa84d061e18e7089e84e7b2651b2d4c565d2a9 /src/mongo/db/repl/isself.h | |
parent | 0adbb451f7393c633686d65fd77b77ddc1161fe4 (diff) | |
download | mongo-daab6fae496e1aca6b8f7c709bd18307745df1dd.tar.gz |
SERVER-14165 port isSelf fastpath to windows
Closes #736
Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'src/mongo/db/repl/isself.h')
-rw-r--r-- | src/mongo/db/repl/isself.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mongo/db/repl/isself.h b/src/mongo/db/repl/isself.h index ea297218056..cbcbbd9f031 100644 --- a/src/mongo/db/repl/isself.h +++ b/src/mongo/db/repl/isself.h @@ -26,15 +26,38 @@ * it in the license file. */ -#include "mongo/util/net/hostandport.h" +#pragma once + +#include <string> +#include <vector> + +#include "mongo/bson/oid.h" namespace mongo { + struct HostAndPort; + namespace repl { /** + * An identifier unique to this instance. Used by isSelf to see if we are talking + * to ourself or someone else. + */ + extern OID instanceId; + + /** * Returns true if "hostAndPort" identifies this instance. */ bool isSelf(const HostAndPort& hostAndPort); + /** + * Returns all the IP addresses bound to the network interfaces of this machine. + * This requires a syscall. If the ipv6enabled parameter is true, both IPv6 AND IPv4 + * addresses will be returned. + * + * Note: this only works on Linux and Windows. All calls should be properly ifdef'd, + * otherwise an invariant will be triggered. + */ + std::vector<std::string> getBoundAddrs(const bool ipv6enabled); + } // namespace repl } // namespace mongo |