mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Fix connection stall when idle p2p refresh occurs
The edge received packets from the supernode and thought that the other peer was still active, but the other peer had dropped the p2p connection due to refresh
This commit is contained in:
parent
f038f22a0b
commit
0e6db6361e
|
@ -422,6 +422,9 @@ static void check_peer_registration_needed(n2n_edge_t * eee,
|
||||||
/* Already in known_peers. */
|
/* Already in known_peers. */
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
|
if(!from_supernode)
|
||||||
|
scan->last_p2p = now;
|
||||||
|
|
||||||
if((now - scan->last_seen) > 0 /* >= 1 sec */) {
|
if((now - scan->last_seen) > 0 /* >= 1 sec */) {
|
||||||
/* Don't register too often */
|
/* Don't register too often */
|
||||||
check_known_peer_sock_change(eee, from_supernode, mac, peer, now);
|
check_known_peer_sock_change(eee, from_supernode, mac, peer, now);
|
||||||
|
@ -1095,7 +1098,7 @@ static int find_peer_destination(n2n_edge_t * eee,
|
||||||
|
|
||||||
if((scan->last_seen > 0) &&
|
if((scan->last_seen > 0) &&
|
||||||
(memcmp(mac_address, scan->mac_addr, N2N_MAC_SIZE) == 0)) {
|
(memcmp(mac_address, scan->mac_addr, N2N_MAC_SIZE) == 0)) {
|
||||||
if((now - scan->last_seen) >= (scan->timeout / 2)) {
|
if((now - scan->last_p2p) >= (scan->timeout / 2)) {
|
||||||
/* Too much time passed since we saw the peer, need to register again
|
/* Too much time passed since we saw the peer, need to register again
|
||||||
* since the peer address may have changed. */
|
* since the peer address may have changed. */
|
||||||
traceEvent(TRACE_DEBUG, "Refreshing idle known peer");
|
traceEvent(TRACE_DEBUG, "Refreshing idle known peer");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user