/* this produced an endless-loop: void Download::getLocks(connIter it, uint64_t chunksize) { Detail::UsedRangePtr used = it->used; Detail::LockedRangePtr locked = it->locked; if (used && !locked) try { // got used, but no lock - try get a lock locked = used->getLock(chunksize); } catch (...) { // lock failed - reset used and recurse used.reset(); return getLocks(it, chunksize); } else if (!used) try { // no used - try get new one used = m_pd->getRange(chunksize); locked.reset(); return getLocks(it, chunksize); // and recurse, will attempt to lock now } catch (...) { // usedrange failed, bail out used.reset(); locked.reset(); } } */ void Download::getLocks(connIter it, uint64_t chunksize) { logTrace(TRACE, "getLocks()"); Detail::UsedRangePtr used = it->used; Detail::LockedRangePtr locked = it->locked; used = m_pd->getRange(chunksize); CHECK_THROW(!used); locked = used->getLock(chunksize); CHECK_THROW(!locked); } Trace-log: ... Trace(HttpDownload): getRandomChunk() Trace(HttpDownload): doGet() Trace(HttpDownload): createConnection(http://localhost/test.bin) Trace(HttpParser): Parser() Trace(HttpDownload): m_connections.insert(Connection(http://localhost/test.bin, 0x8084940, 0x8066828, 0, 0)); Trace(HttpDownload): getLocks() Error: doGet failed: hncore/plugins/http/src/download.cpp:210: Check `!used' failed ...