mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-02-05 19:34:16 +00:00
warnings workaround
This commit is contained in:
parent
bde0ecc8a9
commit
855c1bbc68
@ -136,7 +136,9 @@ void Shutdown()
|
|||||||
boost::filesystem::remove(GetPidFile());
|
boost::filesystem::remove(GetPidFile());
|
||||||
UnregisterWallet(pwalletMain);
|
UnregisterWallet(pwalletMain);
|
||||||
if (pwalletMain)
|
if (pwalletMain)
|
||||||
|
{
|
||||||
delete pwalletMain;
|
delete pwalletMain;
|
||||||
|
}
|
||||||
|
|
||||||
I2PSession::Instance ().Stop ();
|
I2PSession::Instance ().Stop ();
|
||||||
|
|
||||||
@ -826,7 +828,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
CService addrProxy;
|
CService addrProxy;
|
||||||
bool fProxy = false;
|
//bool fProxy = false; // is usable?
|
||||||
if (mapArgs.count("-proxy")) {
|
if (mapArgs.count("-proxy")) {
|
||||||
addrProxy = CService(mapArgs["-proxy"], 9050);
|
addrProxy = CService(mapArgs["-proxy"], 9050);
|
||||||
if (!addrProxy.IsValid())
|
if (!addrProxy.IsValid())
|
||||||
@ -841,7 +843,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
#endif
|
#endif
|
||||||
SetNameProxy(addrProxy, nSocksVersion);
|
SetNameProxy(addrProxy, nSocksVersion);
|
||||||
}
|
}
|
||||||
fProxy = true;
|
//fProxy = true; // is usable?
|
||||||
}
|
}
|
||||||
|
|
||||||
// see Step 2: parameter interactions for more information about these
|
// see Step 2: parameter interactions for more information about these
|
||||||
|
90
src/net.cpp
90
src/net.cpp
@ -990,57 +990,61 @@ void ThreadSocketHandler()
|
|||||||
// Accept new connections
|
// Accept new connections
|
||||||
//
|
//
|
||||||
if (!IsI2POnly())
|
if (!IsI2POnly())
|
||||||
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
|
|
||||||
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
|
|
||||||
{
|
{
|
||||||
|
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
|
||||||
|
{
|
||||||
|
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
|
||||||
|
{
|
||||||
#ifdef USE_IPV6
|
#ifdef USE_IPV6
|
||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
#else
|
#else
|
||||||
struct sockaddr sockaddr;
|
struct sockaddr sockaddr;
|
||||||
#endif
|
#endif
|
||||||
socklen_t len = sizeof(sockaddr);
|
socklen_t len = sizeof(sockaddr);
|
||||||
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
||||||
CAddress addr;
|
CAddress addr;
|
||||||
int nInbound = 0;
|
int nInbound = 0;
|
||||||
|
|
||||||
if (hSocket != INVALID_SOCKET)
|
if (hSocket != INVALID_SOCKET)
|
||||||
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr))
|
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr))
|
||||||
printf("Warning: Unknown socket family\n");
|
printf("Warning: Unknown socket family\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||||
if (pnode->fInbound)
|
if (pnode->fInbound)
|
||||||
nInbound++;
|
nInbound++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hSocket == INVALID_SOCKET)
|
if (hSocket == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
int nErr = WSAGetLastError();
|
int nErr = WSAGetLastError();
|
||||||
if (nErr != WSAEWOULDBLOCK)
|
if (nErr != WSAEWOULDBLOCK)
|
||||||
printf("socket error accept failed: %d\n", nErr);
|
printf("socket error accept failed: %d\n", nErr);
|
||||||
}
|
}
|
||||||
else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS)
|
else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
LOCK(cs_setservAddNodeAddresses);
|
LOCK(cs_setservAddNodeAddresses);
|
||||||
if (!setservAddNodeAddresses.count(addr))
|
if (!setservAddNodeAddresses.count(addr))
|
||||||
|
closesocket(hSocket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CNode::IsBanned(addr))
|
||||||
|
{
|
||||||
|
printf("connection from %s dropped (banned)\n", addr.ToString().c_str());
|
||||||
closesocket(hSocket);
|
closesocket(hSocket);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (CNode::IsBanned(addr))
|
{
|
||||||
{
|
printf("accepted connection %s\n", addr.ToString().c_str());
|
||||||
printf("connection from %s dropped (banned)\n", addr.ToString().c_str());
|
CNode* pnode = new CNode(hSocket, addr, "", true);
|
||||||
closesocket(hSocket);
|
pnode->AddRef();
|
||||||
}
|
{
|
||||||
else
|
LOCK(cs_vNodes);
|
||||||
{
|
vNodes.push_back(pnode);
|
||||||
printf("accepted connection %s\n", addr.ToString().c_str());
|
}
|
||||||
CNode* pnode = new CNode(hSocket, addr, "", true);
|
}
|
||||||
pnode->AddRef();
|
|
||||||
{
|
|
||||||
LOCK(cs_vNodes);
|
|
||||||
vNodes.push_back(pnode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user