void M8MPoolConnectingApp::SendResults(const NonceOriginIdentifier &from, const VerifiedNonces &sharesFound) { AbstractWorkSource *owner = nullptr; asizei poolIndex = 0; for(asizei search = 0; search < pools.size(); search++) { if(pools[search].source.get() == from.owner) { owner = pools[search].source.get(); poolIndex = search; break; } } if(!owner) throw "Impossible, WU owner not found"; // really wrong stuff. Most likely a bug in code or possibly we just got hit by some cosmic ray if(sharesFound.wrong) BadHashes(*owner, sharesFound.device, sharesFound.wrong); auto ntime = owner->IsCurrentJob(from.job); if(ntime) { asizei sent = 0; for(auto &result : sharesFound.nonces) { ShareIdentifier shareSrc; shareSrc.owner = owner; shareSrc.shareIndex = owner->SendShare(from.job, ntime, sharesFound.nonce2, result.nonce); ShareFeedbackData fback; fback.block = result.block; fback.hashSlice = result.hashSlice; fback.shareDiff = result.diff; fback.targetDiff = sharesFound.targetDiff; fback.gpuIndex = sharesFound.device; sentShares.insert(std::make_pair(shareSrc, fback)); sent++; } AddSent(*owner, sent); } else AddStale(sharesFound.device, sharesFound.nonces.size()); }
void SocketEndpoint::HandleSend(const ErrorCode& error, const size_t& bytes_sent) { if (error) { Close(); } AddSent(bytes_sent); SendQueue(); }