[SR-Users] Closing all ws connections

Andrey Deykunov deykunov at gmail.com
Tue Nov 20 13:25:12 CET 2018


Hi guys,

I've implemented an rpc call that closes all WS connections:


void ws_rpc_close_all(rpc_t *rpc, void *ctx)
{
    ws_connection_t **list = NULL, **list_head = NULL;
    ws_connection_t *wsc = NULL;
    int ret;

    list_head = wsconn_get_list();
    if(!list_head)
        return;

    list = list_head;
    wsc = *list_head;
    while(wsc) {
        LM_WARN("Closing connection\n");
        ret = close_connection(&wsc, LOCAL_CLOSE, 1000,
str_status_normal_closure);
        wsc = *(++list);
    }
    wsconn_put_list(list_head);
}

Please take a look. Can I call close_connection() and perform list
iterations in this function not using WSCONN_LOCK?

Thanks,
Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181120/d7238759/attachment.html>


More information about the sr-users mailing list