Skip to content

Commit

Permalink
kill process thread when socket read thread exits
Browse files Browse the repository at this point in the history
  • Loading branch information
goatpig committed Nov 6, 2018
1 parent e62b347 commit 2f82560
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cppForSwig/BitcoinP2P.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,9 +1407,13 @@ void BitcoinP2P::updateNodeStatus(bool connected)
////////////////////////////////////////////////////////////////////////////////
void BitcoinP2PSocket::respond(vector<uint8_t>& packet)
{
readDataStack_->push_back(move(packet));
if (packet.size() >= 0)
readDataStack_->push_back(move(packet));
else
readDataStack_->terminate();
}


////////////////////////////////////////////////////////////////////////////////
void BitcoinP2PSocket::pushPayload(
unique_ptr<Socket_WritePayload> write_payload,
Expand Down
4 changes: 4 additions & 0 deletions cppForSwig/SocketObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ void PersistentSocket::socketService_win()
}

run_.store(false, memory_order_relaxed);
readQueue_.terminate();
}
#endif

Expand Down Expand Up @@ -587,6 +588,9 @@ void PersistentSocket::readService()

respond(payload);
}

vector<uint8_t> emptyPacket;
respond(emptyPacket);
}

///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 2f82560

Please sign in to comment.