mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Important changes to tighten up the connection methods:
* Switched to miniupnpc-1.0 * modified miniupnpc to add lease duration. * set lease duration to 1 Hr. * Modified configure scripts to use miniupnpc-1.0 * added TIMEOUT to all connections (5 sec for TCP - Important!) * reduced TCP offset delay to 2 seconds. * BUGFIX: Added missing connect_parameter wrapper function. * added reset to other connection methods when connection is made. * Added Connection Type (TCP/UDP) information to feedback/GUI * Increased default Data Rates: from 50/50 to 100/500 kB/s * Removed Default Bootstrap Ids. (only automatic now!) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@423 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8079660291
commit
8d3f9a3ec6
@ -59,7 +59,7 @@ const uint32_t MAX_UPNP_INIT = 30; /* seconds UPnP timeout */
|
||||
|
||||
#define CONN_DEBUG 1
|
||||
|
||||
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 10; /* 10 Seconds should be enough! */
|
||||
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 2; /* 2 Seconds? is it be enough! */
|
||||
const uint32_t P3CONNMGR_UDP_DHT_DELAY = DHT_NOTIFY_PERIOD + 60; /* + 1 minute for DHT POST */
|
||||
const uint32_t P3CONNMGR_UDP_PROXY_DELAY = 30; /* 30 seconds (NOT IMPLEMENTED YET!) */
|
||||
|
||||
@ -86,6 +86,7 @@ peerConnectState::peerConnectState()
|
||||
:id("unknown"),
|
||||
netMode(RS_NET_MODE_UNKNOWN), visState(RS_VIS_STATE_STD),
|
||||
lastcontact(0),
|
||||
connecttype(0),
|
||||
lastavailable(0),
|
||||
lastattempt(0),
|
||||
name("nameless"), state(0), actions(0),
|
||||
@ -1328,6 +1329,7 @@ bool p3ConnectMgr::connectResult(std::string id, bool success, uint32_t flags)
|
||||
it->second.actions |= RS_PEER_CONNECTED;
|
||||
mStatusChanged = true;
|
||||
it->second.lastcontact = time(NULL); /* time of connect */
|
||||
it->second.connecttype = flags;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2774,12 +2776,7 @@ bool p3ConnectMgr::addBootstrapStunPeers()
|
||||
struct sockaddr_in dummyaddr;
|
||||
uint32_t flags = 0;
|
||||
|
||||
// Two Defaults for The Initial Release.
|
||||
id = "7ad672ea4d4af8560d5230aff3c88b59";
|
||||
stunCollect(RsUtil::HashId(id, false), dummyaddr, flags);
|
||||
|
||||
id = "8ad7c08e7778e0289de04843bf57a6ae";
|
||||
stunCollect(RsUtil::HashId(id, false), dummyaddr, flags);
|
||||
/* only use the Bootstrap system now */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ const uint32_t RS_NET_FLAGS_ONLINE = 0x0004;
|
||||
const uint32_t RS_NET_FLAGS_EXTERNAL_ADDR = 0x0008;
|
||||
const uint32_t RS_NET_FLAGS_STABLE_UDP = 0x0010;
|
||||
|
||||
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
|
||||
|
||||
class peerAddrInfo
|
||||
{
|
||||
public:
|
||||
@ -126,6 +128,8 @@ class peerConnectState
|
||||
time_t lastcontact;
|
||||
|
||||
/***** Below here not stored permanently *****/
|
||||
|
||||
uint32_t connecttype; // RS_NET_CONN_TCP_ALL / RS_NET_CONN_UDP_ALL
|
||||
time_t lastavailable;
|
||||
time_t lastattempt;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "pqi/pqinetwork.h"
|
||||
|
||||
@ -345,8 +346,9 @@ static const int NET_CONNECT_UNREACHABLE = 3;
|
||||
static const int NET_CONNECT_FIREWALLED = 4;
|
||||
static const int NET_CONNECT_FAILED = 5;
|
||||
|
||||
static const uint32_t NET_PARAM_CONNECT_DELAY = 1;
|
||||
static const uint32_t NET_PARAM_CONNECT_PERIOD = 2;
|
||||
static const uint32_t NET_PARAM_CONNECT_DELAY = 1;
|
||||
static const uint32_t NET_PARAM_CONNECT_PERIOD = 2;
|
||||
static const uint32_t NET_PARAM_CONNECT_TIMEOUT = 3;
|
||||
|
||||
class NetInterface
|
||||
{
|
||||
@ -366,7 +368,7 @@ virtual int disconnect() = 0;
|
||||
virtual int reset() = 0;
|
||||
virtual std::string PeerId() { return peerId; }
|
||||
|
||||
virtual bool connect_parameter(uint32_t type, uint32_t value) { return false; }
|
||||
virtual bool connect_parameter(uint32_t type, uint32_t value) = 0;
|
||||
|
||||
protected:
|
||||
PQInterface *parent() { return p; }
|
||||
|
@ -135,6 +135,7 @@ virtual int listen();
|
||||
virtual int stoplistening();
|
||||
virtual int disconnect();
|
||||
virtual int reset();
|
||||
virtual bool connect_parameter(uint32_t type, uint32_t value) { return false; }
|
||||
|
||||
// Bin Interface.
|
||||
virtual int tick();
|
||||
|
@ -148,6 +148,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
||||
|
||||
/* find the pqi, */
|
||||
pqiconnect *pqi = NULL;
|
||||
uint32_t type = 0;
|
||||
std::map<uint32_t, pqiconnect *>::iterator it;
|
||||
|
||||
/* start again */
|
||||
@ -167,6 +168,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
||||
if ((it->second)->thisNetInterface(ni))
|
||||
{
|
||||
pqi = (it->second);
|
||||
type = (it->first);
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +186,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
||||
|
||||
/* notify */
|
||||
if (pqipg)
|
||||
pqipg->notifyConnect(PeerId(), true);
|
||||
pqipg->notifyConnect(PeerId(), type, true);
|
||||
|
||||
if ((active) && (activepqi != pqi)) // already connected - trouble
|
||||
{
|
||||
@ -202,13 +204,20 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
||||
{
|
||||
|
||||
pqioutput(PQL_WARNING, pqipersonzone,
|
||||
"CONNECT_SUCCESS->marking so!");
|
||||
"CONNECT_SUCCESS->marking so! (resetting others)");
|
||||
// mark as active.
|
||||
active = true;
|
||||
activepqi = pqi;
|
||||
|
||||
|
||||
inConnectAttempt = false;
|
||||
|
||||
/* reset all other children? (clear up long UDP attempt) */
|
||||
for(it = kids.begin(); it != kids.end(); it++)
|
||||
{
|
||||
if (it->second != activepqi)
|
||||
{
|
||||
it->second->reset();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@ -243,7 +252,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
||||
|
||||
/* notify up (But not if we are actually active: rtn -1 case above) */
|
||||
if (pqipg)
|
||||
pqipg->notifyConnect(PeerId(), false);
|
||||
pqipg->notifyConnect(PeerId(), type, false);
|
||||
|
||||
return 1;
|
||||
|
||||
@ -334,7 +343,7 @@ int pqiperson::stoplistening()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period)
|
||||
int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period, uint32_t timeout)
|
||||
{
|
||||
{
|
||||
std::ostringstream out;
|
||||
@ -342,6 +351,9 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay,
|
||||
out << " type: " << type;
|
||||
out << " addr: " << inet_ntoa(raddr.sin_addr);
|
||||
out << ":" << ntohs(raddr.sin_port);
|
||||
out << " delay: " << delay;
|
||||
out << " period: " << period;
|
||||
out << " timeout: " << timeout;
|
||||
out << std::endl;
|
||||
std::cerr << out.str();
|
||||
//pqioutput(PQL_DEBUG_BASIC, pqipersonzone, out.str());
|
||||
@ -363,8 +375,12 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay,
|
||||
|
||||
/* set the parameters */
|
||||
(it->second)->reset();
|
||||
|
||||
std::cerr << "pqiperson::connect() setting connect_parameters" << std::endl;
|
||||
(it->second)->connect_parameter(NET_PARAM_CONNECT_DELAY, delay);
|
||||
(it->second)->connect_parameter(NET_PARAM_CONNECT_PERIOD, period);
|
||||
(it->second)->connect_parameter(NET_PARAM_CONNECT_TIMEOUT, timeout);
|
||||
|
||||
(it->second)->connect(raddr);
|
||||
|
||||
// flag if we started a new connectionAttempt.
|
||||
|
@ -68,6 +68,7 @@ virtual int listen() { return ni -> listen(); }
|
||||
virtual int stoplistening() { return ni -> stoplistening(); }
|
||||
virtual int reset() { return ni -> reset(); }
|
||||
virtual int disconnect() { return ni -> reset(); }
|
||||
virtual bool connect_parameter(uint32_t type, uint32_t value) { return ni -> connect_parameter(type, value);}
|
||||
|
||||
// get the contact from the net side!
|
||||
virtual std::string PeerId()
|
||||
@ -102,7 +103,7 @@ virtual ~pqiperson(); // must clean up children.
|
||||
int reset();
|
||||
int listen();
|
||||
int stoplistening();
|
||||
int connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period);
|
||||
int connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period, uint32_t timeout);
|
||||
|
||||
// add in connection method.
|
||||
int addChildInterface(uint32_t type, pqiconnect *pqi);
|
||||
|
@ -206,10 +206,10 @@ int pqipersongrp::load_config()
|
||||
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone,
|
||||
"pqipersongrp::load_config() Loading Default Rates!");
|
||||
|
||||
setMaxRate(true, 50.0);
|
||||
setMaxRate(false,50.0);
|
||||
setMaxIndivRate(true, 50.0);
|
||||
setMaxIndivRate(false, 50.0);
|
||||
setMaxRate(true, 500.0);
|
||||
setMaxRate(false, 500.0);
|
||||
setMaxIndivRate(true, 100.0);
|
||||
setMaxIndivRate(false, 100.0);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -332,6 +332,7 @@ int pqipersongrp::connectPeer(std::string id)
|
||||
struct sockaddr_in addr;
|
||||
uint32_t delay;
|
||||
uint32_t period;
|
||||
uint32_t timeout;
|
||||
uint32_t type;
|
||||
|
||||
if (!mConnMgr->connectAttempt(id, addr, delay, period, type))
|
||||
@ -352,29 +353,42 @@ int pqipersongrp::connectPeer(std::string id)
|
||||
uint32_t ptype;
|
||||
if (type & RS_NET_CONN_TCP_ALL)
|
||||
{
|
||||
std::cerr << " pqipersongrp::connectPeer() connecting with TCP";
|
||||
std::cerr << std::endl;
|
||||
ptype = PQI_CONNECT_TCP;
|
||||
timeout = RS_TCP_STD_TIMEOUT_PERIOD;
|
||||
std::cerr << " pqipersongrp::connectPeer() connecting with TCP: Timeout :" << timeout;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (type & RS_NET_CONN_UDP_ALL)
|
||||
{
|
||||
std::cerr << " pqipersongrp::connectPeer() connecting with UDP";
|
||||
std::cerr << std::endl;
|
||||
ptype = PQI_CONNECT_UDP;
|
||||
timeout = period * 2;
|
||||
std::cerr << " pqipersongrp::connectPeer() connecting with UDP: Timeout :" << timeout;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
p->connect(ptype, addr, delay, period);
|
||||
p->connect(ptype, addr, delay, period, timeout);
|
||||
|
||||
/* */
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool pqipersongrp::notifyConnect(std::string id, bool success)
|
||||
bool pqipersongrp::notifyConnect(std::string id, uint32_t ptype, bool success)
|
||||
{
|
||||
uint32_t type = 0;
|
||||
if (ptype == PQI_CONNECT_TCP)
|
||||
{
|
||||
type = RS_NET_CONN_TCP_ALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = RS_NET_CONN_UDP_ALL;
|
||||
}
|
||||
|
||||
|
||||
if (mConnMgr)
|
||||
mConnMgr->connectResult(id, success, 0);
|
||||
mConnMgr->connectResult(id, success, type);
|
||||
|
||||
return (NULL != mConnMgr);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ int removePeer(std::string id);
|
||||
int connectPeer(std::string id);
|
||||
|
||||
/*** callback from children ****/
|
||||
bool notifyConnect(std::string id, bool success);
|
||||
bool notifyConnect(std::string id, uint32_t type, bool success);
|
||||
|
||||
// tick interfaces.
|
||||
virtual int tick();
|
||||
|
@ -97,6 +97,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3AuthMgr *am, p3ConnectM
|
||||
net_attempt(0), net_failure(0), net_unreachable(0),
|
||||
sameLAN(false), n_read_zero(0),
|
||||
mConnectDelay(0), mConnectTS(0),
|
||||
mConnectTimeout(0), mTimeoutTS(0),
|
||||
|
||||
/**************** PQI_USE_XPGP ******************/
|
||||
#if defined(PQI_USE_XPGP)
|
||||
@ -250,12 +251,21 @@ int pqissl::reset()
|
||||
|
||||
bool pqissl::connect_parameter(uint32_t type, uint32_t value)
|
||||
{
|
||||
std::cerr << "pqissl::connect_parameter() type: " << type << "value: " << value << std::endl;
|
||||
if (type == NET_PARAM_CONNECT_DELAY)
|
||||
{
|
||||
std::cerr << "pqissl::connect_parameter() DELAY: " << value << std::endl;
|
||||
mConnectDelay = value;
|
||||
return true;
|
||||
}
|
||||
return NetInterface::connect_parameter(type, value);
|
||||
else if (type == NET_PARAM_CONNECT_TIMEOUT)
|
||||
{
|
||||
std::cerr << "pqissl::connect_parameter() TIMEOUT: " << value << std::endl;
|
||||
mConnectTimeout = value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
//return NetInterface::connect_parameter(type, value);
|
||||
}
|
||||
|
||||
|
||||
@ -587,6 +597,9 @@ int pqissl::Initiate_Connection()
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone, out.str());
|
||||
}
|
||||
|
||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||
std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
|
||||
if (0 != (err = unix_connect(osock, (struct sockaddr *) &addr, sizeof(addr))))
|
||||
{
|
||||
std::ostringstream out;
|
||||
@ -675,6 +688,22 @@ int pqissl::Basic_Connection_Complete()
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::Basic_Connection_Complete()...");
|
||||
|
||||
/* new TimeOut code. */
|
||||
if (time(NULL) > mTimeoutTS)
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
"pqissl::Basic_Connection_Complete() Connection Timed Out!");
|
||||
/* as sockfd is valid, this should close it all up */
|
||||
|
||||
std::cerr << "pqissl::Basic_Connection_Complete() Connection Timed Out!";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "pqissl::Basic_Connection_Complete() Timeout Period: " << mConnectTimeout;
|
||||
std::cerr << std::endl;
|
||||
reset();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (waiting != WAITING_SOCK_CONNECT)
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, pqisslzone,
|
||||
|
@ -196,6 +196,8 @@ virtual int net_internal_fcntl_nonblock(int fd) { return unix_fcntl_nonblock(fd)
|
||||
|
||||
uint32_t mConnectDelay;
|
||||
time_t mConnectTS;
|
||||
uint32_t mConnectTimeout;
|
||||
time_t mTimeoutTS;
|
||||
|
||||
/**************** PQI_USE_XPGP ******************/
|
||||
#if defined(PQI_USE_XPGP)
|
||||
|
@ -48,7 +48,6 @@ const int pqissludpzone = 3144;
|
||||
* This is long as the udp connect can take some time.
|
||||
*/
|
||||
|
||||
static const uint32_t PQI_SSLUDP_CONNECT_TIMEOUT = 600; /* 10 minutes - give it longer! */
|
||||
static const uint32_t PQI_SSLUDP_DEF_CONN_PERIOD = 300; /* 5 minutes? */
|
||||
|
||||
/********** PQI SSL UDP STUFF **************************************/
|
||||
@ -187,7 +186,10 @@ int pqissludp::Initiate_Connection()
|
||||
pqioutput(PQL_DEBUG_BASIC, pqissludpzone, out.str());
|
||||
}
|
||||
|
||||
udp_connect_timeout = time(NULL) + PQI_SSLUDP_CONNECT_TIMEOUT;
|
||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||
std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
std::cerr << " Connect Period is:" << mConnectPeriod << std::endl;
|
||||
|
||||
/* <===================== UDP Difference *******************/
|
||||
if (0 != (err = tou_connect(sockfd, (struct sockaddr *) &remote_addr,
|
||||
sizeof(remote_addr), mConnectPeriod)))
|
||||
@ -250,7 +252,7 @@ int pqissludp::Basic_Connection_Complete()
|
||||
"pqissludp::Basic_Connection_Complete()...");
|
||||
|
||||
|
||||
if (time(NULL) > udp_connect_timeout)
|
||||
if (time(NULL) > mTimeoutTS)
|
||||
{
|
||||
pqioutput(PQL_DEBUG_BASIC, pqissludpzone,
|
||||
"pqissludp::Basic_Connection_Complete() Connection Timed Out!");
|
||||
@ -258,7 +260,10 @@ int pqissludp::Basic_Connection_Complete()
|
||||
|
||||
std::cerr << "pqissludp::Basic_Connection_Complete() Connection Timed Out!";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "pqissludp::Basic_Connection_Complete() Timeout Period: " << mConnectTimeout;
|
||||
std::cerr << std::endl;
|
||||
reset();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -396,8 +401,10 @@ int pqissludp::stoplistening()
|
||||
|
||||
bool pqissludp::connect_parameter(uint32_t type, uint32_t value)
|
||||
{
|
||||
std::cerr << "pqissludp::connect_parameter() type: " << type << "value: " << value << std::endl;
|
||||
if (type == NET_PARAM_CONNECT_PERIOD)
|
||||
{
|
||||
std::cerr << "pqissludp::connect_parameter() PERIOD: " << value << std::endl;
|
||||
mConnectPeriod = value;
|
||||
return true;
|
||||
}
|
||||
|
@ -93,9 +93,8 @@ private:
|
||||
|
||||
BIO *tou_bio; // specific to ssludp.
|
||||
|
||||
int remote_timeout;
|
||||
int proxy_timeout;
|
||||
int udp_connect_timeout;
|
||||
//int remote_timeout;
|
||||
//int proxy_timeout;
|
||||
|
||||
long listen_checktime;
|
||||
|
||||
|
@ -343,7 +343,7 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
||||
break;
|
||||
case RS_NET_CONN_UDP_DHT_SYNC:
|
||||
autostr << "UDP (ETA: ";
|
||||
autostr << 360 - (time(NULL) - pcs.currentConnAddr.ts);
|
||||
autostr << 420 - (time(NULL) - pcs.currentConnAddr.ts);
|
||||
autostr << ")";
|
||||
break;
|
||||
default:
|
||||
@ -352,6 +352,21 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
||||
}
|
||||
|
||||
}
|
||||
else if (pcs.state & RS_PEER_S_CONNECTED)
|
||||
{
|
||||
if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
||||
{
|
||||
autostr << "TCP";
|
||||
}
|
||||
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
||||
{
|
||||
autostr << "UDP";
|
||||
}
|
||||
else
|
||||
{
|
||||
autostr << "Unknown Connect Method!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
autostr << "Idle";
|
||||
|
@ -14,8 +14,7 @@ PQI_USE_XPGP = 1
|
||||
#USE_FILELOOK = 1
|
||||
|
||||
SSL_DIR=../../../../../src/openssl-0.9.7g-xpgp-0.1c
|
||||
KADC_DIR=../../../../../src/KadC
|
||||
UPNPC_DIR=../../../../../src/miniupnpc-20070515
|
||||
UPNPC_DIR=../../../../../src/miniupnpc-1.0
|
||||
|
||||
include $(RS_TOP_DIR)/scripts/checks.mk
|
||||
|
||||
@ -73,7 +72,6 @@ ifdef PQI_USE_XPGP
|
||||
LIBS += -L$(SSL_DIR)
|
||||
endif
|
||||
LIBS += -lssl -lcrypto -lpthread
|
||||
#LIBS += -L$(KADC_DIR) -lKadC
|
||||
LIBS += -L$(UPNPC_DIR) -lminiupnpc
|
||||
LIBS += $(XLIB) -ldl -lz
|
||||
|
||||
|
@ -14,7 +14,7 @@ PQI_USE_XPGP = 1
|
||||
#USE_FILELOOK = 1
|
||||
|
||||
SSL_DIR=../../../../../src/openssl-0.9.7g-xpgp-0.1c
|
||||
UPNPC_DIR=../../../../../src/miniupnpc-20070515
|
||||
UPNPC_DIR=../../../../../src/miniupnpc-1.0
|
||||
|
||||
include $(RS_TOP_DIR)/scripts/checks.mk
|
||||
|
||||
|
@ -116,7 +116,7 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
|
||||
char externalIPAddress[16];
|
||||
char intClient[16];
|
||||
char intPort[6];
|
||||
char leaseDuration[] = "600"; /* 10 mins */
|
||||
char leaseDuration[] = "3600"; /* 60 mins */
|
||||
int r;
|
||||
int ok = 1;
|
||||
|
||||
@ -141,11 +141,11 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
|
||||
printf("GetExternalIPAddress failed.\n");
|
||||
|
||||
// Unix at the moment!
|
||||
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
// eport, iport, iaddr, 0, leaseDuration, proto);
|
||||
|
||||
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
eport, iport, iaddr, 0, proto);
|
||||
eport, iport, iaddr, 0, leaseDuration, proto);
|
||||
|
||||
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
|
||||
// eport, iport, iaddr, 0, proto);
|
||||
if(r==0)
|
||||
{
|
||||
printf("AddPortMapping(%s, %s, %s) failed\n", eport, iport, iaddr);
|
||||
|
Loading…
Reference in New Issue
Block a user