int tcplen; /* length of incoming TCPpacket */
int allow_request; /* defined if there's only one request possible */
time_t last_ping_time; /* last time we saw some activity from the other end or pinged them */
+ time_t last_key_renewal; /* last time we renewed the SPTPS key */
struct outgoing_t *outgoing; /* used to keep track of outgoing connections */
}
}
+ if(c->status.active && c->last_key_renewal + 3600 < mesh->loop.now.tv_sec) {
+ if(!sptps_force_kex(&c->sptps)) {
+ logger(mesh, MESHLINK_ERROR, "SPTPS key renewal for connection with %s failed", c->name);
+ terminate_connection(mesh, c, true);
+ continue;
+ } else {
+ c->last_key_renewal = mesh->loop.now.tv_sec;
+ }
+ }
+
if(c->last_ping_time + pingtimeout <= mesh->loop.now.tv_sec) {
if(c->status.active) {
if(c->status.pinged) {
/* Activate this connection */
c->allow_request = ALL;
+ c->last_key_renewal = mesh->loop.now.tv_sec;
c->status.active = true;
logger(mesh, MESHLINK_INFO, "Connection with %s activated", c->name);