diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-04-16 15:46:00 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2016-09-08 12:06:24 -0400 |
commit | 02137f11e2ea5d153f433493639730587836a1e3 (patch) | |
tree | 9d46cc20dbc21c6220adb1f62fe1485ae7f724f1 /src/init.cpp | |
parent | 5b446dd5b11d4f403554bc2dd5a7a94c7d20422a (diff) |
net: Move socket binding into CConnman
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp index 6aaa7bfc5d..b0ffb7a40e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -273,11 +273,11 @@ void HandleSIGHUP(int) fReopenDebugLog = true; } -bool static Bind(const CService &addr, unsigned int flags) { +bool static Bind(CConnman& connman, const CService &addr, unsigned int flags) { if (!(flags & BF_EXPLICIT) && IsLimited(addr)) return false; std::string strError; - if (!BindListenPort(addr, strError, (flags & BF_WHITELIST) != 0)) { + if (!connman.BindListenPort(addr, strError, (flags & BF_WHITELIST) != 0)) { if (flags & BF_REPORT_ERROR) return InitError(strError); return false; @@ -1198,7 +1198,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) CService addrBind; if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false)) return InitError(ResolveErrMsg("bind", strBind)); - fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR)); + fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR)); } BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) { CService addrBind; @@ -1206,14 +1206,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) return InitError(ResolveErrMsg("whitebind", strBind)); if (addrBind.GetPort() == 0) return InitError(strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind)); - fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST)); + fBound |= Bind(connman, addrBind, (BF_EXPLICIT | BF_REPORT_ERROR | BF_WHITELIST)); } } else { struct in_addr inaddr_any; inaddr_any.s_addr = INADDR_ANY; - fBound |= Bind(CService(in6addr_any, GetListenPort()), BF_NONE); - fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE); + fBound |= Bind(connman, CService(in6addr_any, GetListenPort()), BF_NONE); + fBound |= Bind(connman, CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE); } if (!fBound) return InitError(_("Failed to listen on any port. Use -listen=0 if you want this.")); |