diff --git a/PackedMessage.cpp b/PackedMessage.cpp index 98e693019..c6e0b6d7e 100644 --- a/PackedMessage.cpp +++ b/PackedMessage.cpp @@ -17,9 +17,10 @@ PackedMessage::PackedMessage(MessagePointer msg, int type) : mMsg(msg) { unsigned msg_size = mMsg->ByteSize(); + assert(msg_size); mBuffer.resize(HEADER_SIZE + msg_size); encodeHeader(msg_size,type); - mMsg->SerializeToArray(&mBuffer[HEADER_SIZE], msg_size); + if(msg_size) mMsg->SerializeToArray(&mBuffer[HEADER_SIZE], msg_size); } bool PackedMessage::operator == (const PackedMessage& other) diff --git a/Peer.cpp b/Peer.cpp index 49475dbc3..c3085b01e 100644 --- a/Peer.cpp +++ b/Peer.cpp @@ -340,6 +340,7 @@ void Peer::sendHello() { newcoin::TMHello* h=new newcoin::TMHello(); // set up parameters + h->set_version(theConfig.VERSION); PackedMessage::pointer packet(new PackedMessage(PackedMessage::MessagePointer(h), newcoin::mtHELLO)); sendPacket(packet); } diff --git a/PeerDoor.cpp b/PeerDoor.cpp index 0e95356e1..2ff1b63df 100644 --- a/PeerDoor.cpp +++ b/PeerDoor.cpp @@ -9,7 +9,7 @@ using namespace boost::asio::ip; PeerDoor::PeerDoor(boost::asio::io_service& io_service) : mAcceptor(io_service, tcp::endpoint(tcp::v4(), theConfig.PEER_PORT)) { - cout << "Opening door on port: " << theConfig.PEER_PORT << endl; + cout << "Opening peer door on port: " << theConfig.PEER_PORT << endl; startListening(); } diff --git a/RPCDoor.cpp b/RPCDoor.cpp index dec0004a4..0da7482bf 100644 --- a/RPCDoor.cpp +++ b/RPCDoor.cpp @@ -10,7 +10,7 @@ using namespace boost::asio::ip; RPCDoor::RPCDoor(boost::asio::io_service& io_service) : mAcceptor(io_service, tcp::endpoint(boost::asio::ip::address_v4::loopback(), theConfig.RPC_PORT)) { - + cout << "Opening rpc door on port: " << theConfig.RPC_PORT << endl; startListening(); } diff --git a/config.xml b/config.xml index 95f24d530..1df057894 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - 5000 - 5001 + 51235 + 5005 30 diff --git a/main.cpp b/main.cpp index aab97156a..bda17bbe5 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,7 @@ #include "Application.h" #include #include "CallRPC.h" +#include "Config.h" extern void runTests(); using namespace std; @@ -41,6 +42,7 @@ int parseCommandline(int argc, char* argv[]) int ret=0; if(argc>1) { + theConfig.load(); ret=commandLineRPC(argc, argv); if(ret) printHelp(); diff --git a/newcoin.vcxproj b/newcoin.vcxproj index 14cf90dc3..b33684e27 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -87,6 +87,7 @@ + @@ -106,6 +107,7 @@ + @@ -121,7 +123,6 @@ - @@ -200,6 +201,7 @@ + diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index 400269410..adcd59cbc 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -28,6 +28,15 @@ {c3412b4c-4150-48d7-a5f2-24bdb1a39c5b} + + {209ce0bd-b197-4cb2-ad50-f8f43bcd1e03} + + + {46b84833-f245-4c3d-94b8-472efdb3a040} + + + {b27b04b8-1c6e-4b20-9364-f18d4682dc00} + @@ -156,7 +165,10 @@ Source Files - + + Source Files + + Source Files @@ -342,6 +354,9 @@ + + tests\client2 + diff --git a/tests/client2/config.xml b/tests/client2/config.xml index 120935f5a..d01e35c99 100644 --- a/tests/client2/config.xml +++ b/tests/client2/config.xml @@ -1,6 +1,6 @@ 5000 - 5001 + 5002 30