… | |
… | |
1307 | } |
1307 | } |
1308 | |
1308 | |
1309 | inline void |
1309 | inline void |
1310 | connection::keepalive_cb (ev::timer &w, int revents) |
1310 | connection::keepalive_cb (ev::timer &w, int revents) |
1311 | { |
1311 | { |
1312 | if (ev_now () >= last_activity + ::conf.keepalive + 30) |
1312 | if (ev_now () >= last_activity + ::conf.keepalive + 15) |
1313 | { |
1313 | { |
1314 | reset_connection (); |
1314 | reset_connection (); |
1315 | establish_connection (); |
1315 | establish_connection (); |
1316 | } |
1316 | } |
1317 | else if (ev_now () < last_activity + ::conf.keepalive) |
1317 | else if (ev_now () < last_activity + ::conf.keepalive) |
1318 | w.start (last_activity + ::conf.keepalive - ev::now ()); |
1318 | w.start (last_activity + ::conf.keepalive - ev::now ()); |
1319 | else if (conf->connectmode != conf_node::C_ONDEMAND |
1319 | else if (conf->connectmode != conf_node::C_ONDEMAND |
1320 | || THISNODE->connectmode != conf_node::C_ONDEMAND) |
1320 | || THISNODE->connectmode != conf_node::C_ONDEMAND) |
1321 | { |
1321 | { |
1322 | send_ping (si); |
1322 | send_ping (si); |
1323 | w.start (5); |
1323 | w.start (3); |
1324 | } |
1324 | } |
1325 | else if (ev_now () < last_activity + ::conf.keepalive + 10) |
1325 | else if (ev_now () < last_activity + ::conf.keepalive + 10) |
1326 | // hold ondemand connections implicitly a few seconds longer |
1326 | // hold ondemand connections implicitly a few seconds longer |
1327 | // should delete octx, though, or something like that ;) |
1327 | // should delete octx, though, or something like that ;) |
1328 | w.start (last_activity + ::conf.keepalive + 10 - ev::now ()); |
1328 | w.start (last_activity + ::conf.keepalive + 10 - ev::now ()); |