Add heartbeat (an empty packet, wich is 100 bytes long) in p3disc every 4 seconds

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1929 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-12-22 10:41:19 +00:00
parent e6c8e57927
commit 6b9392fcae
7 changed files with 249 additions and 38 deletions

View file

@ -41,6 +41,8 @@ static const int CONNECT_UNREACHABLE = 3;
static const int CONNECT_FIREWALLED = 4;
static const int CONNECT_FAILED = 5;
static const int HEARTBEAT_REPEAT_TIME = 4;
#include "pqi/pqistreamer.h"
class pqiconnect: public pqistreamer, public NetInterface
@ -105,7 +107,7 @@ int reset();
int listen();
int stoplistening();
int connect(uint32_t type, struct sockaddr_in raddr, uint32_t delay, uint32_t period, uint32_t timeout);
int receiveHeartbeat();
// add in connection method.
int addChildInterface(uint32_t type, pqiconnect *pqi);
@ -132,6 +134,7 @@ pqiconnect *getKid(uint32_t type);
pqiconnect *activepqi;
bool inConnectAttempt;
int waittimes;
time_t lastHeartbeatReceived;//use to track connection failure
private: /* Helper functions */