Fixed double PING/PONGs
This commit is contained in:
parent
59148bf023
commit
da7a197338
@ -633,8 +633,10 @@ void check_servers(void)
|
|||||||
}
|
}
|
||||||
if (!inlist) {
|
if (!inlist) {
|
||||||
Syslog('+', "IBC: server %s removed from configuration", tnsl->server);
|
Syslog('+', "IBC: server %s removed from configuration", tnsl->server);
|
||||||
|
pthread_mutex_lock(&b_mutex);
|
||||||
tnsl->remove = TRUE;
|
tnsl->remove = TRUE;
|
||||||
tnsl->action = now;
|
tnsl->action = now;
|
||||||
|
pthread_mutex_unlock(&b_mutex);
|
||||||
srvchg = TRUE;
|
srvchg = TRUE;
|
||||||
callchg = TRUE;
|
callchg = TRUE;
|
||||||
}
|
}
|
||||||
@ -661,6 +663,7 @@ void check_servers(void)
|
|||||||
Syslog('r', "Closing socket %d", tnsl->socket);
|
Syslog('r', "Closing socket %d", tnsl->socket);
|
||||||
shutdown(tnsl->socket, SHUT_WR);
|
shutdown(tnsl->socket, SHUT_WR);
|
||||||
tnsl->socket = -1;
|
tnsl->socket = -1;
|
||||||
|
tnsl->state = NCS_HANGUP;
|
||||||
}
|
}
|
||||||
callchg = TRUE;
|
callchg = TRUE;
|
||||||
srvchg = TRUE;
|
srvchg = TRUE;
|
||||||
@ -674,6 +677,7 @@ void check_servers(void)
|
|||||||
*/
|
*/
|
||||||
if (Remove) {
|
if (Remove) {
|
||||||
Syslog('r', "Starting remove list");
|
Syslog('r', "Starting remove list");
|
||||||
|
pthread_mutex_lock(&b_mutex);
|
||||||
tmp = &ncsl;
|
tmp = &ncsl;
|
||||||
while (*tmp) {
|
while (*tmp) {
|
||||||
if ((*tmp)->remove) {
|
if ((*tmp)->remove) {
|
||||||
@ -686,6 +690,7 @@ void check_servers(void)
|
|||||||
tmp = &((*tmp)->next);
|
tmp = &((*tmp)->next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pthread_mutex_unlock(&b_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_ncslist();
|
dump_ncslist();
|
||||||
@ -782,6 +787,8 @@ void check_servers(void)
|
|||||||
case NCS_CONNECT: /*
|
case NCS_CONNECT: /*
|
||||||
* In this state we check if the connection is still alive
|
* In this state we check if the connection is still alive
|
||||||
*/
|
*/
|
||||||
|
j = (int)now - (int)tnsl->last;
|
||||||
|
|
||||||
if (((int)now - (int)tnsl->last) > 130) {
|
if (((int)now - (int)tnsl->last) > 130) {
|
||||||
/*
|
/*
|
||||||
* Missed 3 PING replies
|
* Missed 3 PING replies
|
||||||
@ -1483,6 +1490,7 @@ void receiver(struct servent *se)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
if (pfd.revents & POLLIN || pfd.revents & POLLERR || pfd.revents & POLLHUP || pfd.revents & POLLNVAL) {
|
if (pfd.revents & POLLIN || pfd.revents & POLLERR || pfd.revents & POLLHUP || pfd.revents & POLLNVAL) {
|
||||||
sl = sizeof(myaddr_in);
|
sl = sizeof(myaddr_in);
|
||||||
memset(&clientaddr_in, 0, sizeof(struct sockaddr_in));
|
memset(&clientaddr_in, 0, sizeof(struct sockaddr_in));
|
||||||
@ -1575,10 +1583,10 @@ void *ibc_thread(void *dummy)
|
|||||||
|
|
||||||
while (! T_Shutdown) {
|
while (! T_Shutdown) {
|
||||||
|
|
||||||
now = time(NULL);
|
|
||||||
/*
|
/*
|
||||||
* Check neighbour servers state
|
* Check neighbour servers state
|
||||||
*/
|
*/
|
||||||
|
now = time(NULL);
|
||||||
check_servers();
|
check_servers();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user