mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
getting connections working
This commit is contained in:
@@ -17,9 +17,10 @@ PackedMessage::PackedMessage(MessagePointer msg, int type)
|
|||||||
: mMsg(msg)
|
: mMsg(msg)
|
||||||
{
|
{
|
||||||
unsigned msg_size = mMsg->ByteSize();
|
unsigned msg_size = mMsg->ByteSize();
|
||||||
|
assert(msg_size);
|
||||||
mBuffer.resize(HEADER_SIZE + msg_size);
|
mBuffer.resize(HEADER_SIZE + msg_size);
|
||||||
encodeHeader(msg_size,type);
|
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)
|
bool PackedMessage::operator == (const PackedMessage& other)
|
||||||
|
|||||||
1
Peer.cpp
1
Peer.cpp
@@ -340,6 +340,7 @@ void Peer::sendHello()
|
|||||||
{
|
{
|
||||||
newcoin::TMHello* h=new newcoin::TMHello();
|
newcoin::TMHello* h=new newcoin::TMHello();
|
||||||
// set up parameters
|
// set up parameters
|
||||||
|
h->set_version(theConfig.VERSION);
|
||||||
PackedMessage::pointer packet(new PackedMessage(PackedMessage::MessagePointer(h), newcoin::mtHELLO));
|
PackedMessage::pointer packet(new PackedMessage(PackedMessage::MessagePointer(h), newcoin::mtHELLO));
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using namespace boost::asio::ip;
|
|||||||
PeerDoor::PeerDoor(boost::asio::io_service& io_service) :
|
PeerDoor::PeerDoor(boost::asio::io_service& io_service) :
|
||||||
mAcceptor(io_service, tcp::endpoint(tcp::v4(), theConfig.PEER_PORT))
|
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();
|
startListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using namespace boost::asio::ip;
|
|||||||
RPCDoor::RPCDoor(boost::asio::io_service& io_service) :
|
RPCDoor::RPCDoor(boost::asio::io_service& io_service) :
|
||||||
mAcceptor(io_service, tcp::endpoint(boost::asio::ip::address_v4::loopback(), theConfig.RPC_PORT))
|
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();
|
startListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<config>
|
<config>
|
||||||
<PEER_PORT>5000</PEER_PORT>
|
<PEER_PORT>51235</PEER_PORT>
|
||||||
<RPC_PORT>5001</RPC_PORT>
|
<RPC_PORT>5005</RPC_PORT>
|
||||||
<NUMBER_CONNECTIONS>30</NUMBER_CONNECTIONS>
|
<NUMBER_CONNECTIONS>30</NUMBER_CONNECTIONS>
|
||||||
</config>
|
</config>
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -1,6 +1,7 @@
|
|||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "CallRPC.h"
|
#include "CallRPC.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
extern void runTests();
|
extern void runTests();
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -41,6 +42,7 @@ int parseCommandline(int argc, char* argv[])
|
|||||||
int ret=0;
|
int ret=0;
|
||||||
if(argc>1)
|
if(argc>1)
|
||||||
{
|
{
|
||||||
|
theConfig.load();
|
||||||
ret=commandLineRPC(argc, argv);
|
ret=commandLineRPC(argc, argv);
|
||||||
if(ret)
|
if(ret)
|
||||||
printHelp();
|
printHelp();
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
<ClCompile Include="AccountState.cpp" />
|
<ClCompile Include="AccountState.cpp" />
|
||||||
<ClCompile Include="Application.cpp" />
|
<ClCompile Include="Application.cpp" />
|
||||||
<ClCompile Include="BitcoinUtil.cpp" />
|
<ClCompile Include="BitcoinUtil.cpp" />
|
||||||
|
<ClCompile Include="CallRPC.cpp" />
|
||||||
<ClCompile Include="Config.cpp" />
|
<ClCompile Include="Config.cpp" />
|
||||||
<ClCompile Include="ConnectionPool.cpp" />
|
<ClCompile Include="ConnectionPool.cpp" />
|
||||||
<ClCompile Include="Conversion.cpp" />
|
<ClCompile Include="Conversion.cpp" />
|
||||||
@@ -106,6 +107,7 @@
|
|||||||
<ClCompile Include="LedgerHistory.cpp" />
|
<ClCompile Include="LedgerHistory.cpp" />
|
||||||
<ClCompile Include="LedgerMaster.cpp" />
|
<ClCompile Include="LedgerMaster.cpp" />
|
||||||
<ClCompile Include="LocalTransaction.cpp" />
|
<ClCompile Include="LocalTransaction.cpp" />
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="NetworkOPs.cpp" />
|
<ClCompile Include="NetworkOPs.cpp" />
|
||||||
<ClCompile Include="newcoin.pb.cc" />
|
<ClCompile Include="newcoin.pb.cc" />
|
||||||
<ClCompile Include="NewcoinAddress.cpp" />
|
<ClCompile Include="NewcoinAddress.cpp" />
|
||||||
@@ -121,7 +123,6 @@
|
|||||||
<ClCompile Include="SHAMap.cpp" />
|
<ClCompile Include="SHAMap.cpp" />
|
||||||
<ClCompile Include="SHAMapDiff.cpp" />
|
<ClCompile Include="SHAMapDiff.cpp" />
|
||||||
<ClCompile Include="SHAMapNodes.cpp" />
|
<ClCompile Include="SHAMapNodes.cpp" />
|
||||||
<ClCompile Include="test.cpp" />
|
|
||||||
<ClCompile Include="TimingService.cpp" />
|
<ClCompile Include="TimingService.cpp" />
|
||||||
<ClCompile Include="Transaction.cpp" />
|
<ClCompile Include="Transaction.cpp" />
|
||||||
<ClCompile Include="UniqueNodeList.cpp" />
|
<ClCompile Include="UniqueNodeList.cpp" />
|
||||||
@@ -200,6 +201,7 @@
|
|||||||
<None Include="Makefile" />
|
<None Include="Makefile" />
|
||||||
<None Include="nodes.xml" />
|
<None Include="nodes.xml" />
|
||||||
<None Include="notes.txt" />
|
<None Include="notes.txt" />
|
||||||
|
<None Include="tests\client2\config.xml" />
|
||||||
<None Include="todo.txt" />
|
<None Include="todo.txt" />
|
||||||
<None Include="unl.xml" />
|
<None Include="unl.xml" />
|
||||||
<None Include="wallet.xml" />
|
<None Include="wallet.xml" />
|
||||||
|
|||||||
@@ -28,6 +28,15 @@
|
|||||||
<Filter Include="Source Files\cryptopp">
|
<Filter Include="Source Files\cryptopp">
|
||||||
<UniqueIdentifier>{c3412b4c-4150-48d7-a5f2-24bdb1a39c5b}</UniqueIdentifier>
|
<UniqueIdentifier>{c3412b4c-4150-48d7-a5f2-24bdb1a39c5b}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="tests">
|
||||||
|
<UniqueIdentifier>{209ce0bd-b197-4cb2-ad50-f8f43bcd1e03}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="tests\client1">
|
||||||
|
<UniqueIdentifier>{46b84833-f245-4c3d-94b8-472efdb3a040}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="tests\client2">
|
||||||
|
<UniqueIdentifier>{b27b04b8-1c6e-4b20-9364-f18d4682dc00}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Application.cpp">
|
<ClCompile Include="Application.cpp">
|
||||||
@@ -156,7 +165,10 @@
|
|||||||
<ClCompile Include="DBInit.cpp">
|
<ClCompile Include="DBInit.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="test.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CallRPC.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -342,6 +354,9 @@
|
|||||||
<None Include="db layout.txt" />
|
<None Include="db layout.txt" />
|
||||||
<None Include="todo.txt" />
|
<None Include="todo.txt" />
|
||||||
<None Include="Makefile" />
|
<None Include="Makefile" />
|
||||||
|
<None Include="tests\client2\config.xml">
|
||||||
|
<Filter>tests\client2</Filter>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="newcoin.proto" />
|
<CustomBuild Include="newcoin.proto" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<config>
|
<config>
|
||||||
<PEER_PORT>5000</PEER_PORT>
|
<PEER_PORT>5000</PEER_PORT>
|
||||||
<RPC_PORT>5001</RPC_PORT>
|
<RPC_PORT>5002</RPC_PORT>
|
||||||
<NUMBER_CONNECTIONS>30</NUMBER_CONNECTIONS>
|
<NUMBER_CONNECTIONS>30</NUMBER_CONNECTIONS>
|
||||||
</config>
|
</config>
|
||||||
|
|||||||
Reference in New Issue
Block a user