diff --git a/src/net.cpp b/src/net.cpp index 8b895df1a..b53787e65 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -963,12 +963,6 @@ static bool AttemptToEvictConnection(bool fPreferNewConnection) { } static void AcceptConnection(const ListenSocket& hListenSocket) { - // don't accept incoming connections until fully synced - if(fMasterNode && !masternodeSync.IsSynced()) { - LogPrintf("AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n"); - return; - } - struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); SOCKET hSocket = accept(hListenSocket.socket, (struct sockaddr*)&sockaddr, &len); @@ -1029,6 +1023,13 @@ static void AcceptConnection(const ListenSocket& hListenSocket) { } } + // don't accept incoming connections until fully synced + if(fMasterNode && !masternodeSync.IsSynced()) { + LogPrintf("AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n"); + CloseSocket(hSocket); + return; + } + CNode* pnode = new CNode(hSocket, addr, "", true); pnode->fWhitelisted = whitelisted;