MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / stream_con_free

Function stream_con_free

modules/event_stream/stream_send.c:373–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373static void stream_con_free(struct stream_con *con)
374{
375 struct list_head *it, *tmp;
376 struct jsonrpc_cmd *cmd;
377
378 if (con->pending_writes != 0)
379 reactor_del_all(con->fd, con->id, 0);
380 else
381 reactor_del_reader(con->fd, con->id, 0);
382 if (con->pending_buffer.len)
383 pkg_free(con->pending_buffer.s);
384
385 list_for_each_safe(it, tmp, &con->cmds) {
386 cmd = list_entry(it, struct jsonrpc_cmd, list);
387 if (cmd->job->async_ctx.status_cb)
388 stream_dispatch_status_cb(&cmd->job->async_ctx, EVI_STATUS_FAIL);
389 list_del(&cmd->list);
390 jsonrpc_cmd_free(cmd);
391 }
392
393 shutdown(con->fd, SHUT_RDWR);
394 close(con->fd);
395 /* remove from the list */
396 list_del(&con->list);
397 pkg_free(con);
398}
399
400
401static void handle_new_stream(stream_send_t *stream)

Callers 3

handle_new_streamFunction · 0.85
handle_reply_jsonrpcFunction · 0.85
handle_write_jsonrpcFunction · 0.85

Calls 5

list_for_each_safeFunction · 0.85
list_delFunction · 0.85
jsonrpc_cmd_freeFunction · 0.85
list_entryClass · 0.50

Tested by

no test coverage detected