BUGFIX: Set default idle connection state only when active
This commit is contained in:
parent
fd976a9066
commit
75d79a5c87
|
@ -153,8 +153,8 @@ main(int argc, char* argv[])
|
|||
setup_signals();
|
||||
for (;;) {
|
||||
ctime = time(NULL);
|
||||
LOG(LOG_DEBUG, "Current time is: %lu", ctime);
|
||||
if (connection.info.state == CONN_IDLE) nanosleep(&sleep, NULL);
|
||||
connection.info.state = CONN_IDLE;
|
||||
if (!run || connection.info.state == CONN_CLOSING) {
|
||||
signed long temp;
|
||||
if ((temp = Assm_mesg(buf.send.buffer, Assm_cmd_QUIT(connection.data.quitmsg), sizeof(buf.send.buffer))) > 0) {
|
||||
|
@ -177,9 +177,9 @@ main(int argc, char* argv[])
|
|||
connection.info.state = CONN_CLOSED;
|
||||
LOG(LOG_VERBOSE, "Connection to " ADDRFMT " was closed.", connection.data.address, connection.data.service);
|
||||
break;
|
||||
} else if (connection.info.state == CONN_CLOSED)
|
||||
} else if (connection.info.state == CONN_CLOSED) {
|
||||
break;
|
||||
else if (connection.info.state == CONN_RECONNECTING) {
|
||||
} else if (connection.info.state == CONN_RECONNECTING) {
|
||||
close(buf.send.fd);
|
||||
close(buf.fifo.fd);
|
||||
connection.info.state = CONN_PENDING;
|
||||
|
@ -279,6 +279,7 @@ main(int argc, char* argv[])
|
|||
}
|
||||
} else if (connection.info.state == CONN_ACTIVE || connection.info.state == CONN_IDLE) {
|
||||
connection.info.reconinter = 0;
|
||||
connection.info.state = CONN_IDLE;
|
||||
if (connection.data.timeout > 0 && connection.info.l_message < ctime - connection.data.timeout) {
|
||||
LOG(LOG_WARN, "Timed out because no message was received since %lu.", connection.info.l_message);
|
||||
connection.info.state = CONN_RECONNECTING;
|
||||
|
|
Reference in New Issue