[sofia-sip] Timed out or not established wss should be destroyed immediately and avoid keep-alive functionality.

This commit is contained in:
Andrey Volk 2020-05-09 20:08:58 +04:00
parent 43614fd12a
commit 323c10d34b
3 changed files with 21 additions and 6 deletions

View File

@ -1 +1 @@
Thu Apr 30 14:02:03 UTC 2020
Sat May 09 16:04:04 UTC 2020

View File

@ -2266,6 +2266,8 @@ int tport_set_secondary_timer(tport_t *self)
return 0;
if (tport_is_closed(self)) {
again:
if (self->tp_refs == 0) {
SU_DEBUG_7(("tport(%p): set timer at %u ms because %s\n",
(void *)self, 0, "zap"));
@ -2291,9 +2293,14 @@ int tport_set_secondary_timer(tport_t *self)
}
}
if (self->tp_pri->pri_vtable->vtp_next_secondary_timer)
self->tp_pri->pri_vtable->
vtp_next_secondary_timer(self, &target, &why);
if (self->tp_pri->pri_vtable->vtp_next_secondary_timer) {
if (self->tp_pri->pri_vtable->
vtp_next_secondary_timer(self, &target, &why) == -1) {
if (tport_is_closed(self)) {
goto again;
}
}
}
if (su_time_cmp(target, infinity)) {
SU_DEBUG_7(("tport(%p): set timer at %ld ms because %s\n",

View File

@ -635,6 +635,8 @@ int tport_ws_next_timer(tport_t *self,
SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n",
__func__, (void *)self,
(punt == 2 ? "Timeout establishing SSL" : "Error establishing SSL"), TPN_ARGS(self->tp_name), ""));
if (wstp->ws.secure)
return -1;
}
@ -646,7 +648,13 @@ int tport_ws_next_timer(tport_t *self,
/** WS timer. */
void tport_ws_timer(tport_t *self, su_time_t now)
{
tport_recv_timeout_timer(self, now);
tport_keepalive_timer(self, now);
tport_ws_t *wstp = (tport_ws_t *)self;
if (!strcmp("wss", self->tp_protoname) && !wstp->ws.secure_established) {
tport_close(self);
} else {
tport_recv_timeout_timer(self, now);
tport_keepalive_timer(self, now);
}
tport_base_timer(self, now);
}