Cleanups mostly.

This commit is contained in:
JoelKatz
2012-05-01 02:27:54 -07:00
parent 77ebac9b5f
commit 6c131d86ab
2 changed files with 15 additions and 18 deletions

View File

@@ -493,18 +493,15 @@ void Peer::recvHello(newcoin::TMHello& packet)
std::cerr << "Recv(Hello): Disconnect: Bad node public key." << std::endl;
}
else if (!mNodePublic.verifyNodePublic(mCookieHash, packet.nodeproof()))
{
// Unable to verify they have private key for claimed public key.
{ // Unable to verify they have private key for claimed public key.
std::cerr << "Recv(Hello): Disconnect: Failed to verify session." << std::endl;
}
else if (!theApp->getConnectionPool().peerConnected(shared_from_this(), mNodePublic))
{
// Already connected, self, or some other reason.
{ // Already connected, self, or some other reason.
std::cerr << "Recv(Hello): Disconnect: Extraneous connection." << std::endl;
}
else
{
// Successful connection.
{ // Successful connection.
// Cancel verification timeout.
(void) mVerifyTimer.cancel();
@@ -642,11 +639,11 @@ void Peer::recvGetLedger(newcoin::TMGetLedger& packet)
ledger=theApp->getMasterLedger().getCurrentLedger();
else if(packet.has_ltype() && (packet.ltype() == newcoin::ltCLOSING) )
{
ledger=theApp->getMasterLedger().getClosingLedger();
ledger = theApp->getMasterLedger().getClosedLedger();
}
else if(packet.has_ltype() && (packet.ltype() == newcoin::ltCLOSED) )
{
ledger=theApp->getMasterLedger().getClosingLedger();
ledger = theApp->getMasterLedger().getClosedLedger();
if(ledger && !ledger->isClosed())
ledger = theApp->getMasterLedger().getLedgerBySeq(ledger->getLedgerSeq() - 1);
}
@@ -776,11 +773,12 @@ void Peer::sendHello()
h->set_nodeproof(&vchSig[0], vchSig.size());
h->set_ipv4port(theConfig.PEER_PORT);
Ledger::pointer closingLedger=theApp->getMasterLedger().getClosingLedger();
if(closingLedger->isClosed())
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
assert(closedLedger && closedLedger->isClosed());
if(closedLedger->isClosed())
{
Serializer s(128);
closingLedger->addRaw(s);
closedLedger->addRaw(s);
h->set_closedledger(s.getDataPtr(), s.getLength());
}

View File

@@ -48,7 +48,6 @@ protected:
std::vector<uint8_t> mReadbuf;
std::list<PackedMessage::pointer> mSendQ;
PackedMessage::pointer mSendingPacket;
std::bitset<32> mPeerBits;
Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx);