mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-25 22:14:15 +00:00
Take -port into account when resolving -bind's
This commit is contained in:
parent
139d2f7c29
commit
5a3cb32e59
@ -611,14 +611,14 @@ bool AppInit2(int argc, char* argv[])
|
|||||||
std::string strError;
|
std::string strError;
|
||||||
if (mapArgs.count("-bind")) {
|
if (mapArgs.count("-bind")) {
|
||||||
BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
|
BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
|
||||||
fBound |= Bind(CService(strBind, GetDefaultPort(), false));
|
fBound |= Bind(CService(strBind, GetListenPort(), false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct in_addr inaddr_any;
|
struct in_addr inaddr_any;
|
||||||
inaddr_any.s_addr = INADDR_ANY;
|
inaddr_any.s_addr = INADDR_ANY;
|
||||||
fBound |= Bind(CService(inaddr_any, GetDefaultPort()));
|
fBound |= Bind(CService(inaddr_any, GetListenPort()));
|
||||||
#ifdef USE_IPV6
|
#ifdef USE_IPV6
|
||||||
fBound |= Bind(CService(in6addr_any, GetDefaultPort()));
|
fBound |= Bind(CService(in6addr_any, GetListenPort()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!fBound)
|
if (!fBound)
|
||||||
@ -628,7 +628,7 @@ bool AppInit2(int argc, char* argv[])
|
|||||||
if (mapArgs.count("-externalip"))
|
if (mapArgs.count("-externalip"))
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"])
|
BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"])
|
||||||
AddLocal(CNetAddr(strAddr, fNameLookup), LOCAL_MANUAL);
|
AddLocal(CService(strAddr, GetListenPort(), fNameLookup), LOCAL_MANUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapArgs.count("-paytxfee"))
|
if (mapArgs.count("-paytxfee"))
|
||||||
|
@ -231,11 +231,9 @@ bool AddLocal(const CService& addr, int nScore)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddLocal(const CNetAddr& addr, int nScore, int port)
|
bool AddLocal(const CNetAddr &addr, int nScore)
|
||||||
{
|
{
|
||||||
if (port == -1)
|
return AddLocal(CService(addr, GetListenPort()), nScore);
|
||||||
port = GetListenPort();
|
|
||||||
return AddLocal(CService(addr, port), nScore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Make a particular network entirely off-limits (no automatic connects to it) */
|
/** Make a particular network entirely off-limits (no automatic connects to it) */
|
||||||
|
@ -38,6 +38,7 @@ CNode* FindNode(const CNetAddr& ip);
|
|||||||
CNode* FindNode(const CService& ip);
|
CNode* FindNode(const CService& ip);
|
||||||
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64 nTimeout=0);
|
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64 nTimeout=0);
|
||||||
void MapPort(bool fMapPort);
|
void MapPort(bool fMapPort);
|
||||||
|
unsigned short GetListenPort();
|
||||||
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
||||||
void StartNode(void* parg);
|
void StartNode(void* parg);
|
||||||
bool StopNode();
|
bool StopNode();
|
||||||
@ -58,7 +59,7 @@ enum
|
|||||||
void SetLimited(enum Network net, bool fLimited = true);
|
void SetLimited(enum Network net, bool fLimited = true);
|
||||||
bool IsLimited(const CNetAddr& addr);
|
bool IsLimited(const CNetAddr& addr);
|
||||||
bool AddLocal(const CService& addr, int nScore = LOCAL_NONE);
|
bool AddLocal(const CService& addr, int nScore = LOCAL_NONE);
|
||||||
bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE, int port = -1);
|
bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE);
|
||||||
bool SeenLocal(const CService& addr);
|
bool SeenLocal(const CService& addr);
|
||||||
bool IsLocal(const CService& addr);
|
bool IsLocal(const CService& addr);
|
||||||
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = NULL);
|
bool GetLocal(CService &addr, const CNetAddr *paddrPeer = NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user