1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +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:
Andy Green 2018-05-22 16:28:50 +08:00
parent 95c0e8bf15
commit 0d787fa312

View file

@ -1245,8 +1245,7 @@ int rops_handle_POLLOUT_ws(struct lws *wsi)
return LWS_HP_RET_BAIL_OK;
}
if (lwsi_role_client(wsi) && !wsi->socket_is_permanently_unusable &&
wsi->ws->send_check_ping) {
if (!wsi->socket_is_permanently_unusable && wsi->ws->send_check_ping) {
lwsl_info("issuing ping on wsi %p\n", wsi);
wsi->ws->send_check_ping = 0;
@ -1411,15 +1410,13 @@ rops_periodic_checks_ws(struct lws_context *context, int tsi, time_t now)
wsi->ws->time_next_ping_check) >
context->ws_ping_pong_interval) {
lwsl_info("req pp on wsi %p\n",
wsi);
lwsl_info("req pp on wsi %p\n", wsi);
wsi->ws->send_check_ping = 1;
lws_set_timeout(wsi,
PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING,
context->timeout_secs);
lws_callback_on_writable(wsi);
wsi->ws->time_next_ping_check =
now;
wsi->ws->time_next_ping_check = now;
}
wsi = wsi->same_vh_protocol_next;
}