remove non active web socket clients in keep alive callback (nw)

This commit is contained in:
Miodrag Milanovic 2013-08-12 14:14:24 +00:00
parent 5f184e36d6
commit bc0e399730

View File

@ -117,7 +117,8 @@ void *web_engine::websocket_keepalive()
m_lastupdatetime = curtime;
for (simple_list_wrapper<mg_connection> *curitem = m_websockets.first(); curitem != NULL; curitem = curitem->next())
{
mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_PING, NULL, 0);
int status = mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_PING, NULL, 0);
if (status==0) m_websockets.remove(*curitem); // remove inactive clients
}
}
osd_sleep(osd_ticks_per_second()/5);