bool RecvLine(SOCKET hSocket, string& strLine)
{
strLine = "";
- loop
+ while (true)
{
char c;
int nBytes = recv(hSocket, &c, 1, 0);
{
if (strLine.empty()) // HTTP response is separated from headers by blank line
{
- loop
+ while (true)
{
if (!RecvLine(hSocket, strLine))
{
list<CNode*> vNodesDisconnected;
unsigned int nPrevNodeCount = 0;
- loop
+ while (true)
{
//
// Disconnect nodes
else
printf("UPnP Port Mapping successful.\n");
int i = 1;
- loop {
+ while (true)
+ {
if (fShutdown || !fUseUPnP)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
freeUPNPDevlist(devlist); devlist = 0;
if (r != 0)
FreeUPNPUrls(&urls);
- loop {
+ while (true)
+ {
if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
// The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses.
static const char *strDNSSeed[][2] = {
- {"novacoin.su", "seed.novacoin.su"},
+ {"novacoin.su", "dnsseed.novacoin.su"},
};
void ThreadDNSAddressSeed(void* parg)
{
DumpAddresses();
vnThreadsRunning[THREAD_DUMPADDRESS]--;
- Sleep(100000);
+ Sleep(600000);
vnThreadsRunning[THREAD_DUMPADDRESS]++;
}
vnThreadsRunning[THREAD_DUMPADDRESS]--;
try
{
vnThreadsRunning[THREAD_MINTER]++;
- BitcoinMiner(pwallet, true);
+ StakeMiner(pwallet);
vnThreadsRunning[THREAD_MINTER]--;
}
catch (std::exception& e) {
// Initiate network connections
int64 nStart = GetTime();
- loop
+ while (true)
{
ProcessOneShot();
int64 nANow = GetAdjustedTime();
int nTries = 0;
- loop
+ while (true)
{
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
}
}
}
- loop
+ while (true)
{
vector<vector<CService> > vservConnectAddresses = vservAddressesToAdd;
// Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry
// and enable it by default or not. Try to enable it, if possible.
if (addrBind.IsIPv6()) {
#ifdef IPV6_V6ONLY
+#ifdef WIN32
+ setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
+#else
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
#endif
+#endif
#ifdef WIN32
int nProtLevel = 10 /* PROTECTION_LEVEL_UNRESTRICTED */;
int nParameterId = 23 /* IPV6_PROTECTION_LEVEl */;
// Start threads
//
-/*
if (!GetBoolArg("-dnsseed", true))
printf("DNS seeding disabled\n");
else
if (!NewThread(ThreadDNSAddressSeed, NULL))
printf("Error: NewThread(ThreadDNSAddressSeed) failed\n");
-*/
-
- if (!GetBoolArg("-dnsseed", false))
- printf("DNS seeding disabled\n");
- if (GetBoolArg("-dnsseed", false))
- printf("DNS seeding NYI\n");
// Map ports with UPnP
if (fUseUPnP)
}
}
instance_of_cnetcleanup;
+
+void RelayTransaction(const CTransaction& tx, const uint256& hash)
+{
+ CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
+ ss.reserve(10000);
+ ss << tx;
+ RelayTransaction(tx, hash, ss);
+}
+
+void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataStream& ss)
+{
+ CInv inv(MSG_TX, hash);
+ {
+ LOCK(cs_mapRelay);
+ // Expire old relay messages
+ while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime())
+ {
+ mapRelay.erase(vRelayExpiration.front().second);
+ vRelayExpiration.pop_front();
+ }
+
+ // Save original serialized message so newer versions are preserved
+ mapRelay.insert(std::make_pair(inv, ss));
+ vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv));
+ }
+
+ RelayInventory(inv);
+}