mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
final code, working on local machine
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1811 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
020bb73665
commit
d2f9f1c4f1
@ -126,7 +126,7 @@ void addPeer(std::string id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void peerStatus(std::string id,
|
virtual void peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t mode, uint32_t source)
|
uint32_t type, uint32_t mode, uint32_t source)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ void addPeer(std::string id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void peerStatus(std::string id,
|
virtual void peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t mode, uint32_t source)
|
uint32_t type, uint32_t mode, uint32_t source)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1528,12 +1528,12 @@ bool p3ConnectMgr::connectAttempt(std::string id, struct sockaddr_in &addr,
|
|||||||
it->second.connAddrs.pop_front();
|
it->second.connAddrs.pop_front();
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONN_DEBUG
|
|
||||||
addr = it->second.currentConnAddrAttempt.addr;
|
addr = it->second.currentConnAddrAttempt.addr;
|
||||||
delay = it->second.currentConnAddrAttempt.delay;
|
delay = it->second.currentConnAddrAttempt.delay;
|
||||||
period = it->second.currentConnAddrAttempt.period;
|
period = it->second.currentConnAddrAttempt.period;
|
||||||
type = it->second.currentConnAddrAttempt.type;
|
type = it->second.currentConnAddrAttempt.type;
|
||||||
|
|
||||||
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::connectAttempt() Success: ";
|
std::cerr << "p3ConnectMgr::connectAttempt() Success: ";
|
||||||
std::cerr << " id: " << id;
|
std::cerr << " id: " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -1668,7 +1668,7 @@ bool p3ConnectMgr::connectResult(std::string id, bool success, uint32_t flags)
|
|||||||
|
|
||||||
|
|
||||||
void p3ConnectMgr::peerStatus(std::string id,
|
void p3ConnectMgr::peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipDiscAddressList,
|
||||||
uint32_t type, uint32_t flags, uint32_t source)
|
uint32_t type, uint32_t flags, uint32_t source)
|
||||||
{
|
{
|
||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
@ -1698,6 +1698,7 @@ void p3ConnectMgr::peerStatus(std::string id,
|
|||||||
std::cerr << " flags: " << flags;
|
std::cerr << " flags: " << flags;
|
||||||
std::cerr << " source: " << source;
|
std::cerr << " source: " << source;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
peerConnectState::printIpAddressList(ipDiscAddressList);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Log */
|
/* Log */
|
||||||
@ -1772,6 +1773,10 @@ void p3ConnectMgr::peerStatus(std::string id,
|
|||||||
it->second.source = RS_CB_DISC;
|
it->second.source = RS_CB_DISC;
|
||||||
it->second.disc = details;
|
it->second.disc = details;
|
||||||
|
|
||||||
|
it->second.currentlocaladdr = laddr;
|
||||||
|
it->second.currentserveraddr = raddr;
|
||||||
|
it->second.updateIpAddressList(ipDiscAddressList);
|
||||||
|
|
||||||
if (flags & RS_NET_FLAGS_ONLINE)
|
if (flags & RS_NET_FLAGS_ONLINE)
|
||||||
{
|
{
|
||||||
it->second.actions |= RS_PEER_ONLINE;
|
it->second.actions |= RS_PEER_ONLINE;
|
||||||
@ -1796,6 +1801,7 @@ void p3ConnectMgr::peerStatus(std::string id,
|
|||||||
|
|
||||||
it->second.currentlocaladdr = laddr;
|
it->second.currentlocaladdr = laddr;
|
||||||
it->second.currentserveraddr = raddr;
|
it->second.currentserveraddr = raddr;
|
||||||
|
it->second.updateIpAddressList(ipDiscAddressList);
|
||||||
|
|
||||||
it->second.state |= RS_PEER_S_ONLINE;
|
it->second.state |= RS_PEER_S_ONLINE;
|
||||||
it->second.lastavailable = now;
|
it->second.lastavailable = now;
|
||||||
@ -3771,6 +3777,11 @@ void peerConnectState::updateIpAddressList(std::list<IpAddressTimed> ipTimedList
|
|||||||
}
|
}
|
||||||
|
|
||||||
void peerConnectState::updateIpAddressList(IpAddressTimed ipTimed) { //purge old addresses to keep a small list
|
void peerConnectState::updateIpAddressList(IpAddressTimed ipTimed) { //purge old addresses to keep a small list
|
||||||
|
#ifdef CONN_DEBUG
|
||||||
|
std::cerr << "peerConnectState::updateIpAdressList() ip " << inet_ntoa(ipTimed.ipAddr.sin_addr);
|
||||||
|
std::cerr << ":" << ntohs(ipTimed.ipAddr.sin_port);
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
if (ipTimed.ipAddr.sin_addr.s_addr == 0) {
|
if (ipTimed.ipAddr.sin_addr.s_addr == 0) {
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "peerConnectState::updateIpAdressList() ip parameter is 0.0.0.0, do nothing." << std::endl;
|
std::cerr << "peerConnectState::updateIpAdressList() ip parameter is 0.0.0.0, do nothing." << std::endl;
|
||||||
@ -3781,24 +3792,25 @@ void peerConnectState::updateIpAddressList(IpAddressTimed ipTimed) { //purge old
|
|||||||
//check if the ip list contains the current remote address of the connected peer
|
//check if the ip list contains the current remote address of the connected peer
|
||||||
bool found = false;
|
bool found = false;
|
||||||
std::list<IpAddressTimed>::iterator ipListIt;
|
std::list<IpAddressTimed>::iterator ipListIt;
|
||||||
for (ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()); ipListIt++) {
|
for (ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()) && !found; ipListIt++) {
|
||||||
if (ipListIt->ipAddr.sin_addr.s_addr == ipTimed.ipAddr.sin_addr.s_addr && ipListIt->ipAddr.sin_port == ipTimed.ipAddr.sin_port) {
|
if (is_same_address(*ipListIt, ipTimed)) {
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "peerConnectState::updateIpAdressList() ip found in the list. Update seen time for : ";
|
std::cerr << "peerConnectState::updateIpAdressList() ip found in the list.";
|
||||||
std::cerr << inet_ntoa(ipListIt->ipAddr.sin_addr);
|
|
||||||
std::cerr << ":" << ntohs(ipListIt->ipAddr.sin_port);
|
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
found = true;
|
found = true;
|
||||||
//update the seen time
|
//update the seen time
|
||||||
if (ipListIt->seenTime < ipTimed.seenTime) {
|
if (ipListIt->seenTime < ipTimed.seenTime) {
|
||||||
ipListIt->seenTime = ipTimed.seenTime;
|
ipListIt->seenTime = ipTimed.seenTime;
|
||||||
|
#ifdef CONN_DEBUG
|
||||||
|
std::cerr << "peerConnectState::updateIpAdressList() Update seen time to : " << ipTimed.seenTime << std::endl;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found && (ipTimed.ipAddr.sin_addr.s_addr != 0)) {
|
if (!found) {
|
||||||
//add the current addresses to the ip list
|
//add the current addresses to the ip list
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "peerConnectState::updateIpAdressList() adding to the ip list the current remote addr : " << id << " address : ";
|
std::cerr << "peerConnectState::updateIpAdressList() adding to the ip list the current remote addr : " << id << " address : ";
|
||||||
@ -3811,7 +3823,7 @@ void peerConnectState::updateIpAddressList(IpAddressTimed ipTimed) { //purge old
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void peerConnectState::printIpAddressList() { //purge old addresses to keep a small list
|
void peerConnectState::printIpAddressList() {
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "peerConnectState::printIpAdressList() current ip list for the peer : " << id;
|
std::cerr << "peerConnectState::printIpAdressList() current ip list for the peer : " << id;
|
||||||
std::cerr << ", size : " << ipAddressList.size();
|
std::cerr << ", size : " << ipAddressList.size();
|
||||||
@ -3826,3 +3838,17 @@ void peerConnectState::printIpAddressList() { //purge old addresses to keep a sm
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void peerConnectState::printIpAddressList(std::list<IpAddressTimed> ipTimedList) {
|
||||||
|
#ifdef CONN_DEBUG
|
||||||
|
std::cerr << "peerConnectState::printIpAdressList()" << std::endl;
|
||||||
|
#endif
|
||||||
|
for (std::list<IpAddressTimed>::iterator ipListIt = ipTimedList.begin(); ipListIt!=(ipTimedList.end()); ipListIt++) {
|
||||||
|
#ifdef CONN_DEBUG
|
||||||
|
std::cerr << inet_ntoa(ipListIt->ipAddr.sin_addr);
|
||||||
|
std::cerr << ":" << ntohs(ipListIt->ipAddr.sin_port);
|
||||||
|
std::cerr << " seenTime : " << ipListIt->seenTime << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -149,6 +149,7 @@ class peerConnectState
|
|||||||
static bool compare_seen_time (IpAddressTimed first, IpAddressTimed second);
|
static bool compare_seen_time (IpAddressTimed first, IpAddressTimed second);
|
||||||
static bool is_same_address (IpAddressTimed first, IpAddressTimed second);
|
static bool is_same_address (IpAddressTimed first, IpAddressTimed second);
|
||||||
void printIpAddressList();
|
void printIpAddressList();
|
||||||
|
static void printIpAddressList(std::list<IpAddressTimed> ipTimedList);
|
||||||
|
|
||||||
//used to store current ip (for config and connection management)
|
//used to store current ip (for config and connection management)
|
||||||
struct sockaddr_in currentlocaladdr; /* Mandatory */
|
struct sockaddr_in currentlocaladdr; /* Mandatory */
|
||||||
@ -255,7 +256,7 @@ void removeMonitor(pqiMonitor *mon);
|
|||||||
|
|
||||||
/******* overloaded from pqiConnectCb *************/
|
/******* overloaded from pqiConnectCb *************/
|
||||||
virtual void peerStatus(std::string id,
|
virtual void peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t flags, uint32_t source);
|
uint32_t type, uint32_t flags, uint32_t source);
|
||||||
virtual void peerConnectRequest(std::string id,
|
virtual void peerConnectRequest(std::string id,
|
||||||
struct sockaddr_in raddr, uint32_t source);
|
struct sockaddr_in raddr, uint32_t source);
|
||||||
|
@ -1756,7 +1756,8 @@ bool p3DhtMgr::dhtResultSearch(std::string idhash,
|
|||||||
|
|
||||||
if (doCb)
|
if (doCb)
|
||||||
{
|
{
|
||||||
mConnCb->peerStatus(ent.id, ent.laddr, ent.raddr,
|
std::list<IpAddressTimed> ipAddressList;
|
||||||
|
mConnCb->peerStatus(ent.id, ent.laddr, ent.raddr, ipAddressList,
|
||||||
ent.type, 0, RS_CB_DHT);
|
ent.type, 0, RS_CB_DHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ pqiConnectCbDummy::~pqiConnectCbDummy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void pqiConnectCbDummy::peerStatus(std::string id,
|
void pqiConnectCbDummy::peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t mode, uint32_t source)
|
uint32_t type, uint32_t mode, uint32_t source)
|
||||||
{
|
{
|
||||||
std::cerr << "pqiConnectCbDummy::peerStatus()";
|
std::cerr << "pqiConnectCbDummy::peerStatus()";
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "serialiser/rsconfigitems.h"
|
||||||
|
|
||||||
/************** Define Type/Mode/Source ***************/
|
/************** Define Type/Mode/Source ***************/
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ class pqiConnectCb
|
|||||||
public:
|
public:
|
||||||
virtual ~pqiConnectCb() { return; }
|
virtual ~pqiConnectCb() { return; }
|
||||||
virtual void peerStatus(std::string id,
|
virtual void peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t flags, uint32_t source) = 0;
|
uint32_t type, uint32_t flags, uint32_t source) = 0;
|
||||||
|
|
||||||
virtual void peerConnectRequest(std::string id,
|
virtual void peerConnectRequest(std::string id,
|
||||||
@ -125,7 +126,7 @@ class pqiConnectCbDummy: public pqiConnectCb
|
|||||||
pqiConnectCbDummy();
|
pqiConnectCbDummy();
|
||||||
virtual ~pqiConnectCbDummy();
|
virtual ~pqiConnectCbDummy();
|
||||||
virtual void peerStatus(std::string id,
|
virtual void peerStatus(std::string id,
|
||||||
struct sockaddr_in laddr, struct sockaddr_in raddr,
|
struct sockaddr_in laddr, struct sockaddr_in raddr, std::list<IpAddressTimed> ipAddressList,
|
||||||
uint32_t type, uint32_t mode, uint32_t source);
|
uint32_t type, uint32_t mode, uint32_t source);
|
||||||
|
|
||||||
virtual void peerConnectRequest(std::string id,
|
virtual void peerConnectRequest(std::string id,
|
||||||
|
@ -181,6 +181,11 @@ uint32_t RsDiscSerialiser::sizeItem(RsDiscOwnItem *item)
|
|||||||
s += 2; /* contact_tf */
|
s += 2; /* contact_tf */
|
||||||
s += 4; /* discFlags */
|
s += 4; /* discFlags */
|
||||||
|
|
||||||
|
//add the size of the ip list
|
||||||
|
int ipListSize = item->ipAddressList.size();
|
||||||
|
s += ipListSize * GetTlvIpAddrPortV4Size();
|
||||||
|
s += ipListSize * 8; //size of an uint64
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +220,13 @@ bool RsDiscSerialiser::serialiseItem(RsDiscOwnItem *item, void *data, uint32
|
|||||||
ok &= setRawUInt16(data, tlvsize, &offset, item->contact_tf);
|
ok &= setRawUInt16(data, tlvsize, &offset, item->contact_tf);
|
||||||
ok &= setRawUInt32(data, tlvsize, &offset, item->discFlags);
|
ok &= setRawUInt32(data, tlvsize, &offset, item->discFlags);
|
||||||
|
|
||||||
|
//store the ip list
|
||||||
|
std::list<IpAddressTimed>::iterator ipListIt;
|
||||||
|
for (ipListIt = item->ipAddressList.begin(); ipListIt!=(item->ipAddressList.end()); ipListIt++) {
|
||||||
|
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_REMOTE, &(ipListIt->ipAddr));
|
||||||
|
ok &= setRawUInt64(data, tlvsize, &offset, ipListIt->seenTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
@ -273,6 +285,18 @@ RsDiscOwnItem *RsDiscSerialiser::deserialiseOwnItem(void *data, uint32_t *pktsiz
|
|||||||
ok &= getRawUInt16(data, rssize, &offset, &(item->contact_tf));
|
ok &= getRawUInt16(data, rssize, &offset, &(item->contact_tf));
|
||||||
ok &= getRawUInt32(data, rssize, &offset, &(item->discFlags));
|
ok &= getRawUInt32(data, rssize, &offset, &(item->discFlags));
|
||||||
|
|
||||||
|
//get the ip adress list
|
||||||
|
std::list<IpAddressTimed> ipTimedList;
|
||||||
|
while (offset < rssize) {
|
||||||
|
IpAddressTimed ipTimed;
|
||||||
|
ok &= GetTlvIpAddrPortV4(data, rssize, &offset, TLV_TYPE_IPV4_REMOTE, &ipTimed.ipAddr);
|
||||||
|
uint64_t time;
|
||||||
|
ok &= getRawUInt64(data, rssize, &offset, &time);
|
||||||
|
ipTimed.seenTime = time;
|
||||||
|
ipTimedList.push_back(ipTimed);
|
||||||
|
}
|
||||||
|
item->ipAddressList = ipTimedList;
|
||||||
|
|
||||||
if (offset != rssize)
|
if (offset != rssize)
|
||||||
{
|
{
|
||||||
#ifdef RSSERIAL_DEBUG
|
#ifdef RSSERIAL_DEBUG
|
||||||
@ -353,6 +377,11 @@ uint32_t RsDiscSerialiser::sizeReply(RsDiscReply *item)
|
|||||||
s += GetTlvStringSize(item->aboutId);
|
s += GetTlvStringSize(item->aboutId);
|
||||||
s += item->certDER.TlvSize();
|
s += item->certDER.TlvSize();
|
||||||
|
|
||||||
|
//add the size of the ip list
|
||||||
|
int ipListSize = item->ipAddressList.size();
|
||||||
|
s += ipListSize * GetTlvIpAddrPortV4Size();
|
||||||
|
s += ipListSize * 8; //size of an uint64
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,6 +418,14 @@ bool RsDiscSerialiser::serialiseReply(RsDiscReply *item, void *data, uint32_
|
|||||||
|
|
||||||
ok &= item->certDER.SetTlv(data, tlvsize, &offset);
|
ok &= item->certDER.SetTlv(data, tlvsize, &offset);
|
||||||
|
|
||||||
|
|
||||||
|
//store the ip list
|
||||||
|
std::list<IpAddressTimed>::iterator ipListIt;
|
||||||
|
for (ipListIt = item->ipAddressList.begin(); ipListIt!=(item->ipAddressList.end()); ipListIt++) {
|
||||||
|
ok &= SetTlvIpAddrPortV4(data, tlvsize, &offset, TLV_TYPE_IPV4_REMOTE, &(ipListIt->ipAddr));
|
||||||
|
ok &= setRawUInt64(data, tlvsize, &offset, ipListIt->seenTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (offset != tlvsize)
|
if (offset != tlvsize)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
@ -451,6 +488,17 @@ RsDiscReply *RsDiscSerialiser::deserialiseReply(void *data, uint32_t *pktsize)
|
|||||||
TLV_TYPE_STR_PEERID, item->aboutId);
|
TLV_TYPE_STR_PEERID, item->aboutId);
|
||||||
ok &= item->certDER.GetTlv(data, rssize, &offset);
|
ok &= item->certDER.GetTlv(data, rssize, &offset);
|
||||||
|
|
||||||
|
//get the ip adress list
|
||||||
|
std::list<IpAddressTimed> ipTimedList;
|
||||||
|
while (offset < rssize) {
|
||||||
|
IpAddressTimed ipTimed;
|
||||||
|
ok &= GetTlvIpAddrPortV4(data, rssize, &offset, TLV_TYPE_IPV4_REMOTE, &ipTimed.ipAddr);
|
||||||
|
uint64_t time;
|
||||||
|
ok &= getRawUInt64(data, rssize, &offset, &time);
|
||||||
|
ipTimed.seenTime = time;
|
||||||
|
ipTimedList.push_back(ipTimed);
|
||||||
|
}
|
||||||
|
item->ipAddressList = ipTimedList;
|
||||||
|
|
||||||
if (offset != rssize)
|
if (offset != rssize)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,10 @@ class RsDiscOwnItem: public RsDiscItem
|
|||||||
virtual void clear();
|
virtual void clear();
|
||||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
|
//use for transmitting ip address list
|
||||||
|
std::list<IpAddressTimed> ipAddressList;
|
||||||
|
|
||||||
|
//use for transmitting my own adress list
|
||||||
struct sockaddr_in laddr;
|
struct sockaddr_in laddr;
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
|
|
||||||
@ -81,7 +85,7 @@ virtual ~RsDiscReply();
|
|||||||
virtual void clear();
|
virtual void clear();
|
||||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
//use for transmitting peer adress list
|
//use for transmitting ip address list
|
||||||
std::list<IpAddressTimed> ipAddressList;
|
std::list<IpAddressTimed> ipAddressList;
|
||||||
|
|
||||||
//use for transmitting my own adress list
|
//use for transmitting my own adress list
|
||||||
|
@ -360,6 +360,7 @@ void p3disc::sendOwnDetails(std::string to)
|
|||||||
di -> PeerId(to);
|
di -> PeerId(to);
|
||||||
di -> laddr = detail.currentlocaladdr;
|
di -> laddr = detail.currentlocaladdr;
|
||||||
di -> saddr = detail.currentserveraddr;
|
di -> saddr = detail.currentserveraddr;
|
||||||
|
di -> ipAddressList = detail.getIpAddressList();
|
||||||
di -> contact_tf = 0;
|
di -> contact_tf = 0;
|
||||||
|
|
||||||
/* construct disc flags */
|
/* construct disc flags */
|
||||||
@ -630,7 +631,7 @@ void p3disc::recvPeerOwnMsg(RsDiscOwnItem *item)
|
|||||||
flags |= RS_NET_FLAGS_STABLE_UDP;
|
flags |= RS_NET_FLAGS_STABLE_UDP;
|
||||||
}
|
}
|
||||||
|
|
||||||
mConnMgr->peerStatus(item->PeerId(), item->laddr, item->saddr,
|
mConnMgr->peerStatus(item->PeerId(), item->laddr, item->saddr, item->ipAddressList,
|
||||||
type, flags, RS_CB_PERSON);
|
type, flags, RS_CB_PERSON);
|
||||||
|
|
||||||
/* also add as potential stun buddy */
|
/* also add as potential stun buddy */
|
||||||
@ -703,7 +704,7 @@ void p3disc::recvPeerFriendMsg(RsDiscReply *item)
|
|||||||
/* only valid certs, and not ourselves */
|
/* only valid certs, and not ourselves */
|
||||||
if ((loaded) && (peerId != mConnMgr->getOwnId()))
|
if ((loaded) && (peerId != mConnMgr->getOwnId()))
|
||||||
{
|
{
|
||||||
mConnMgr->peerStatus(peerId, item->currentladdr, item->currentsaddr, type, flags, RS_CB_DISC);
|
mConnMgr->peerStatus(peerId, item->currentladdr, item->currentsaddr, item->ipAddressList, type, flags, RS_CB_DISC);
|
||||||
|
|
||||||
std::string hashid1 = RsUtil::HashId(peerId, false);
|
std::string hashid1 = RsUtil::HashId(peerId, false);
|
||||||
mConnMgr->stunStatus(hashid1, item->currentsaddr, type, RS_STUN_FRIEND_OF_FRIEND);
|
mConnMgr->stunStatus(hashid1, item->currentsaddr, type, RS_STUN_FRIEND_OF_FRIEND);
|
||||||
|
Loading…
Reference in New Issue
Block a user