more fixes with interlink

pull/2/head
Tom Early 3 years ago
parent 385da379cc
commit b3d2a00533

@ -3,7 +3,7 @@
# #
# One line per entry. # One line per entry.
# Each entry specifies a remote URF to peer with. # Each entry specifies a remote URF to peer with.
# If no Port is specified, 17000 will be used. # If no Port is specified, 10017 will be used.
# If DHT is enabled and the target is also DHT-enabled, then you only # If DHT is enabled and the target is also DHT-enabled, then you only
# need to specify the URF-Callsign and the Shared-Modules # need to specify the URF-Callsign and the Shared-Modules
# format: # format:

@ -69,6 +69,8 @@ bool CInterlinkMap::LoadFromFile(const std::string &filename)
{ {
CCallsign callsign(token[0]); CCallsign callsign(token[0]);
// read remaining tokens // read remaining tokens
// 1=IP 2=Modules 3=Port Port is optional and defaults to 10017
// OR... 1=Modules and the dht will be used
for (int i=1; i<4; i++) for (int i=1; i<4; i++)
{ {
token[i] = strtok(nullptr, delim); token[i] = strtok(nullptr, delim);
@ -85,13 +87,9 @@ bool CInterlinkMap::LoadFromFile(const std::string &filename)
std::cout << token[0] << " Port " << port << " is out of range, resetting to 10017." << std::endl; std::cout << token[0] << " Port " << port << " is out of range, resetting to 10017." << std::endl;
port = 10017; port = 10017;
} }
m_InterlinkMap[token[0]] = CInterlinkMapItem(token[1], token[3], (uint16_t)port);
} }
else
{
m_InterlinkMap[token[0]] = CInterlinkMapItem(token[1], token[2], (uint16_t)port); m_InterlinkMap[token[0]] = CInterlinkMapItem(token[1], token[2], (uint16_t)port);
} }
}
#ifndef NO_DHT #ifndef NO_DHT
else if (token[1]) else if (token[1])
{ {

@ -65,6 +65,7 @@ void CURFProtocol::Task(void)
if ( Receive4(Buffer, Ip, 20) ) if ( Receive4(Buffer, Ip, 20) )
#endif #endif
{ {
Buffer.Dump("Received buffer");
// crack the packet // crack the packet
if ( IsValidDvFramePacket(Buffer, Frame) ) if ( IsValidDvFramePacket(Buffer, Frame) )
{ {
@ -348,7 +349,7 @@ void CURFProtocol::HandlePeerLinks(void)
// send connect packet to re-initiate peer link // send connect packet to re-initiate peer link
EncodeConnectPacket(&buffer, it->second.GetModules().c_str()); EncodeConnectPacket(&buffer, it->second.GetModules().c_str());
Send(buffer, it->second.GetIp(), it->second.GetPort()); Send(buffer, it->second.GetIp(), it->second.GetPort());
std::cout << "Sent connect packet to URF peer " << cs << " @ " << it->second.GetIp() << " for modules " << it->second.GetModules() << std::endl; std::cout << "Sent connect packet to URF peer " << cs << " @ " << it->second.GetIp() << " for modules " << it->second.GetModules() << " to port " << it->second.GetPort() << std::endl;
#ifndef NO_DHT #ifndef NO_DHT
} }
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.