BUGFIX: Big BUG in External Port notification! FIXED.

An invalid comparison was being made - meaning the EXT_PORT_FLAG was not set.
 This can lead to failed connection attempts.

Added dht_check_peers program.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@409 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-23 22:27:43 +00:00
parent d335e37c8d
commit 0c0147abe6
3 changed files with 18 additions and 15 deletions

View file

@ -10,10 +10,10 @@ include $(RS_TOP_DIR)/scripts/config.mk
RSOBJ = b64.o opendhtstr.o opendht.o opendhtmgr.o RSOBJ = b64.o opendhtstr.o opendht.o opendhtmgr.o
TESTOBJ = odhtstr_test.o odhtpost_test.o odhtmgr_test.o \ TESTOBJ = odhtstr_test.o odhtpost_test.o odhtmgr_test.o \
dht_bootstrap.o dht_bootstrap.o dht_check_peers.o
TESTS = odhtstr_test odhtpost_test odhtmgr_test \ TESTS = odhtstr_test odhtpost_test odhtmgr_test \
dht_bootstrap dht_bootstrap dht_check_peers
all: librs tests all: librs tests
@ -21,6 +21,9 @@ all: librs tests
dhttest: $(OBJ) dhttest.o dhttest: $(OBJ) dhttest.o
$(CC) $(CFLAGS) -o dhttest $(OBJ) dhttest.o $(LIBS) $(CC) $(CFLAGS) -o dhttest $(OBJ) dhttest.o $(LIBS)
dht_check_peers: $(OBJ) dht_check_peers.o
$(CC) $(CFLAGS) -o dht_check_peers $(OBJ) dht_check_peers.o $(LIBS)
odhtpost_test: $(OBJ) odhtpost_test.o odhtpost_test: $(OBJ) odhtpost_test.o
$(CC) $(CFLAGS) -o odhtpost_test $(OBJ) odhtpost_test.o $(LIBS) $(CC) $(CFLAGS) -o odhtpost_test $(OBJ) odhtpost_test.o $(LIBS)

View file

@ -402,8 +402,8 @@ int main(int argc, char **argv)
} }
/* switch off Stun/Bootstrap stuff */ /* switch off Stun/Bootstrap stuff */
dht.doneStun(); dhtTester.doneStun();
dht.setBootstrapAllowed(false); dhtTester.setBootstrapAllowed(false);
/* wait loop */ /* wait loop */

View file

@ -278,7 +278,7 @@ void p3ConnectMgr::netStartup()
default: default:
/* Force it here (could be default!) */ /* Force it here (could be default!) */
ownState.netMode |= RS_NET_MODE_TRY_UPNP; ownState.netMode |= RS_NET_MODE_TRY_UPNP;
ownState.netMode |= RS_NET_MODE_UDP; ownState.netMode |= RS_NET_MODE_UDP; /* set to UDP, upgraded is UPnP is Okay */
mNetStatus = RS_NET_UPNP_INIT; mNetStatus = RS_NET_UPNP_INIT;
break; break;
} }
@ -569,16 +569,7 @@ void p3ConnectMgr::netUdpCheck()
ownState.serveraddr = extAddr; ownState.serveraddr = extAddr;
mode = RS_NET_CONN_TCP_LOCAL; mode = RS_NET_CONN_TCP_LOCAL;
if (mUpnpAddrValid || (ownState.netMode == RS_NET_MODE_EXT)) if (!extAddrStable)
{
mode |= RS_NET_CONN_TCP_EXTERNAL;
mode |= RS_NET_CONN_UDP_DHT_SYNC;
}
else if (extAddrStable)
{
mode |= RS_NET_CONN_UDP_DHT_SYNC;
}
else // if (!extAddrStable)
{ {
#ifdef CONN_DEBUG #ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::netUdpCheck() UDP Unstable :( "; std::cerr << "p3ConnectMgr::netUdpCheck() UDP Unstable :( ";
@ -616,6 +607,15 @@ void p3ConnectMgr::netUdpCheck()
} }
} }
else if (mUpnpAddrValid || (ownState.netMode & RS_NET_MODE_EXT))
{
mode |= RS_NET_CONN_TCP_EXTERNAL;
mode |= RS_NET_CONN_UDP_DHT_SYNC;
}
else // if (extAddrStable)
{
mode |= RS_NET_CONN_UDP_DHT_SYNC;
}
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
} }