mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Networking REWORK: Changes for other bits
* Fixed #includes in upnp * switched p3disc over to the new data types. * added new source to .pro file * minor changes to other code. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3249 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8745c2fe2e
commit
ae4ee9df00
@ -214,7 +214,9 @@ HEADERS += dbase/cachestrapper.h \
|
||||
# ft/ftdwlqueue.h \
|
||||
pqi/sslfns.h \
|
||||
pqi/authssl.h \
|
||||
pqi/authssltest.h \
|
||||
pqi/authgpg.h \
|
||||
pqi/authgpgtest.h \
|
||||
pqi/cleanupxpgp.h \
|
||||
# pqi/p3authmgr.h \
|
||||
pqi/p3cfgmgr.h \
|
||||
@ -230,6 +232,7 @@ HEADERS += dbase/cachestrapper.h \
|
||||
pqi/pqihandler.h \
|
||||
pqi/pqihash.h \
|
||||
pqi/pqiindic.h \
|
||||
pqi/pqiipset.h \
|
||||
pqi/pqilistener.h \
|
||||
pqi/pqiloopback.h \
|
||||
pqi/pqimonitor.h \
|
||||
@ -291,6 +294,7 @@ HEADERS += dbase/cachestrapper.h \
|
||||
serialiser/rstlvkvwide.h \
|
||||
serialiser/rstlvtypes.h \
|
||||
serialiser/rstlvutil.h \
|
||||
serialiser/rstlvaddrs.h \
|
||||
services/p3channels.h \
|
||||
services/p3chatservice.h \
|
||||
services/p3disc.h \
|
||||
@ -335,7 +339,9 @@ HEADERS += dbase/cachestrapper.h \
|
||||
SOURCES += \
|
||||
pqi/sslfns.cc \
|
||||
pqi/authssl.cc \
|
||||
pqi/authssltest.cc \
|
||||
pqi/authgpg.cc \
|
||||
pqi/authgpgtest.cc \
|
||||
pqi/cleanupxpgp.cc \
|
||||
pqi/p3notify.cc \
|
||||
pqi/pqipersongrp.cc \
|
||||
@ -352,6 +358,7 @@ SOURCES += \
|
||||
pqi/p3cfgmgr.cc \
|
||||
pqi/p3connmgr.cc \
|
||||
pqi/p3dhtmgr.cc \
|
||||
pqi/pqiipset.cc \
|
||||
pqi/pqiarchive.cc \
|
||||
pqi/pqibin.cc \
|
||||
pqi/pqimonitor.cc \
|
||||
@ -430,6 +437,7 @@ SOURCES += \
|
||||
serialiser/rstlvbase.cc \
|
||||
serialiser/rstlvtypes.cc \
|
||||
serialiser/rsserial.cc \
|
||||
serialiser/rstlvaddrs.cc \
|
||||
tcponudp/extaddrfinder.cc \
|
||||
tcponudp/bss_tou.c \
|
||||
tcponudp/tcpstream.cc \
|
||||
|
@ -127,11 +127,13 @@ int RsServer::UpdateAllConfig()
|
||||
|
||||
/* update network configuration */
|
||||
|
||||
config.netLocalOk = mConnMgr->getNetStatusLocalOk();
|
||||
config.netUpnpOk = mConnMgr->getNetStatusUpnpOk();
|
||||
config.netDhtOk = mConnMgr->getNetStatusDhtOk();
|
||||
config.netStunOk = mConnMgr->getNetStatusStunOk();
|
||||
config.netExtraAddressOk = mConnMgr->getNetStatusExtraAddressCheckOk();
|
||||
pqiNetStatus status;
|
||||
mConnMgr->getNetStatus(status);
|
||||
config.netLocalOk = status.mLocalAddrOk;
|
||||
config.netUpnpOk = status.mUpnpOk;
|
||||
config.netDhtOk = status.mDhtOk;
|
||||
config.netStunOk = false;
|
||||
config.netExtraAddressOk = status.mExtAddrOk;
|
||||
|
||||
/* update DHT/UPnP config */
|
||||
|
||||
|
@ -307,30 +307,27 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
||||
/* generate */
|
||||
d.authcode = "AUTHCODE";
|
||||
|
||||
|
||||
//TODO : check use of this details
|
||||
// From all addresses, show the most recent one if no address is currently in use.
|
||||
struct sockaddr_in best_local_addr = (!strcmp(inet_ntoa(pcs.currentlocaladdr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.laddr,pcs.dht.ts,pcs.disc.laddr,pcs.disc.ts,pcs.peer.laddr,pcs.peer.ts):pcs.currentlocaladdr ;
|
||||
struct sockaddr_in best_servr_addr = (!strcmp(inet_ntoa(pcs.currentserveraddr.sin_addr),"0.0.0.0"))?getPreferredAddress(pcs.dht.raddr,pcs.dht.ts,pcs.disc.raddr,pcs.disc.ts,pcs.peer.raddr,pcs.peer.ts):pcs.currentserveraddr ;
|
||||
|
||||
|
||||
/* fill from pcs */
|
||||
|
||||
d.localAddr = inet_ntoa(best_local_addr.sin_addr);
|
||||
d.localPort = ntohs(best_local_addr.sin_port);
|
||||
d.extAddr = inet_ntoa(best_servr_addr.sin_addr);
|
||||
d.extPort = ntohs(best_servr_addr.sin_port);
|
||||
d.localAddr = inet_ntoa(pcs.currentlocaladdr.sin_addr);
|
||||
d.localPort = ntohs(pcs.currentlocaladdr.sin_port);
|
||||
d.extAddr = inet_ntoa(pcs.currentserveraddr.sin_addr);
|
||||
d.extPort = ntohs(pcs.currentserveraddr.sin_port);
|
||||
d.dyndns = pcs.dyndns;
|
||||
d.lastConnect = pcs.lastcontact;
|
||||
d.connectPeriod = 0;
|
||||
std::list<IpAddressTimed> pcsList = pcs.getIpAddressList();
|
||||
d.ipAddressList.clear();
|
||||
for (std::list<IpAddressTimed>::iterator ipListIt = pcsList.begin(); ipListIt!=(pcsList.end()); ipListIt++) {
|
||||
|
||||
|
||||
std::list<pqiIpAddress>::iterator it;
|
||||
for(it = pcs.ipAddrs.mExt.mAddrs.begin();
|
||||
it != pcs.ipAddrs.mExt.mAddrs.end(); it++)
|
||||
{
|
||||
std::ostringstream toto;
|
||||
toto << ntohs(ipListIt->ipAddr.sin_port) << " " << (time(NULL) - ipListIt->seenTime) << " sec";
|
||||
d.ipAddressList.push_back(std::string(inet_ntoa(ipListIt->ipAddr.sin_addr)) + ":" + toto.str());
|
||||
toto << ntohs(it->mAddr.sin_port) << " " << (time(NULL) - it->mSeenTime) << " sec";
|
||||
d.ipAddressList.push_back(std::string(inet_ntoa(it->mAddr.sin_addr)) + ":" + toto.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Translate */
|
||||
|
||||
|
@ -525,6 +525,10 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
||||
* 2) Get List of Available Accounts.
|
||||
* 4) Get List of GPG Accounts.
|
||||
*/
|
||||
/* create singletons */
|
||||
AuthSSLInit();
|
||||
AuthGPGInit();
|
||||
|
||||
AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL);
|
||||
|
||||
// first check config directories, and set bootstrap values.
|
||||
@ -2249,7 +2253,7 @@ int RsServer::StartupRetroShare()
|
||||
|
||||
//mConfigMgr->addConfiguration("ftserver.cfg", ftserver);
|
||||
//
|
||||
mConfigMgr->addConfiguration("gpg_prefs.cfg", AuthGPG::getAuthGPG());
|
||||
mConfigMgr->addConfiguration("gpg_prefs.cfg", (AuthGPGimpl *) AuthGPG::getAuthGPG());
|
||||
mConfigMgr->loadConfiguration();
|
||||
|
||||
//mConfigMgr->addConfiguration("sslcerts.cfg", AuthSSL::getAuthSSL());
|
||||
|
@ -353,7 +353,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about) {
|
||||
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
||||
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
||||
rsPeerNetItem->dyndns = detail.dyndns;
|
||||
rsPeerNetItem->ipAddressList = detail.getIpAddressList();
|
||||
detail.ipAddrs.mLocal.loadTlv(rsPeerNetItem->localAddrList);
|
||||
detail.ipAddrs.mExt.loadTlv(rsPeerNetItem->extAddrList);
|
||||
|
||||
|
||||
di->rsPeerList.push_back(*rsPeerNetItem);
|
||||
}
|
||||
@ -377,7 +379,9 @@ void p3disc::sendPeerDetails(std::string to, std::string about) {
|
||||
rsPeerNetItem->currentlocaladdr = detail.currentlocaladdr;
|
||||
rsPeerNetItem->currentremoteaddr = detail.currentserveraddr;
|
||||
rsPeerNetItem->dyndns = detail.dyndns;
|
||||
rsPeerNetItem->ipAddressList = detail.getIpAddressList();
|
||||
detail.ipAddrs.mLocal.loadTlv(rsPeerNetItem->localAddrList);
|
||||
detail.ipAddrs.mExt.loadTlv(rsPeerNetItem->extAddrList);
|
||||
|
||||
|
||||
di->rsPeerList.push_back(*rsPeerNetItem);
|
||||
}
|
||||
@ -610,18 +614,25 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
|
||||
merge = false ;
|
||||
}
|
||||
}
|
||||
|
||||
pqiIpAddrSet addrsFromPeer;
|
||||
addrsFromPeer.mLocal.loadTlv(pitem->localAddrList);
|
||||
addrsFromPeer.mExt.loadTlv(pitem->extAddrList);
|
||||
|
||||
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "Friend is already connected -> not updating" << std::endl;
|
||||
|
||||
std::cerr << "Setting address list to peer " << pitem->pid << ", to be:" << std::endl ;
|
||||
for(std::list<IpAddressTimed>::const_iterator it(pitem->ipAddressList.begin());it!=pitem->ipAddressList.end();++it)
|
||||
std::cerr << " " << (*it).ipAddr << " (" << (*it).seenTime << ")" << std::endl ;
|
||||
|
||||
addrsFromPeer.printAddrs(std::cerr);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
// allways update address list and dns, except if it's ours
|
||||
if (pitem->dyndns != "")
|
||||
mConnMgr->setDynDNS(pitem->pid, pitem->dyndns);
|
||||
|
||||
mConnMgr->updateAddressList(pitem->pid, pitem->ipAddressList,merge);
|
||||
mConnMgr->updateAddressList(pitem->pid, addrsFromPeer);
|
||||
}
|
||||
#ifdef P3DISC_DEBUG
|
||||
else
|
||||
|
@ -30,9 +30,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "upnp.h"
|
||||
#include "upnptools.h"
|
||||
#include "upnpdebug.h"
|
||||
#include <upnp/upnp.h>
|
||||
#include <upnp/upnptools.h>
|
||||
#include <upnp/upnpdebug.h>
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
#include "upnp.h"
|
||||
#include <upnp/upnp.h>
|
||||
#include "upnp/UPnPBase.h"
|
||||
|
||||
#define RS_UPNP_S_UNINITIALISED 0
|
||||
|
Loading…
Reference in New Issue
Block a user