mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
ws: pingpong: server wants to send pings too
During the role refactoring pingpong accidentally became something only a client wsi could initiate. https://github.com/warmcat/libwebsockets/issues/1283
This commit is contained in:
parent
82fc4756be
commit
34d07125e7
1 changed files with 3 additions and 6 deletions
|
@ -1246,8 +1246,7 @@ int rops_handle_POLLOUT_ws(struct lws *wsi)
|
||||||
return LWS_HP_RET_BAIL_OK;
|
return LWS_HP_RET_BAIL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lwsi_role_client(wsi) && !wsi->socket_is_permanently_unusable &&
|
if (!wsi->socket_is_permanently_unusable && wsi->ws->send_check_ping) {
|
||||||
wsi->ws->send_check_ping) {
|
|
||||||
|
|
||||||
lwsl_info("issuing ping on wsi %p\n", wsi);
|
lwsl_info("issuing ping on wsi %p\n", wsi);
|
||||||
wsi->ws->send_check_ping = 0;
|
wsi->ws->send_check_ping = 0;
|
||||||
|
@ -1412,15 +1411,13 @@ rops_periodic_checks_ws(struct lws_context *context, int tsi, time_t now)
|
||||||
wsi->ws->time_next_ping_check) >
|
wsi->ws->time_next_ping_check) >
|
||||||
context->ws_ping_pong_interval) {
|
context->ws_ping_pong_interval) {
|
||||||
|
|
||||||
lwsl_info("req pp on wsi %p\n",
|
lwsl_info("req pp on wsi %p\n", wsi);
|
||||||
wsi);
|
|
||||||
wsi->ws->send_check_ping = 1;
|
wsi->ws->send_check_ping = 1;
|
||||||
lws_set_timeout(wsi,
|
lws_set_timeout(wsi,
|
||||||
PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
|
PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
|
||||||
context->timeout_secs);
|
context->timeout_secs);
|
||||||
lws_callback_on_writable(wsi);
|
lws_callback_on_writable(wsi);
|
||||||
wsi->ws->time_next_ping_check =
|
wsi->ws->time_next_ping_check = now;
|
||||||
now;
|
|
||||||
}
|
}
|
||||||
wsi = wsi->same_vh_protocol_next;
|
wsi = wsi->same_vh_protocol_next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue