Call ws_close_if_able instead of ws_client_free in worker.c

Update last call to ws_client_free to use ws_close_if_able instead, from
worker.c
master
Jessie Murray 3 years ago
parent 887e0ec73f
commit 6539ae13f9
No known key found for this signature in database
GPG Key ID: E7E4D57EDDA744C5

@ -113,7 +113,7 @@ ws_client_new(struct http_client *http_client) {
return ws;
}
void
static void
ws_client_free(struct ws_client *ws) {
/* mark WS client as closing to skip the Redis callback */
@ -558,7 +558,7 @@ ws_frame_and_send_response(struct ws_client *ws, enum ws_frame_type frame_type,
return ws_schedule_write(ws);
}
static void
void
ws_close_if_able(struct ws_client *ws) {
ws->close_after_events = 1; /* note that we're closing */

@ -46,9 +46,6 @@ struct ws_client {
struct ws_client *
ws_client_new(struct http_client *http_client);
void
ws_client_free(struct ws_client *ws);
int
ws_handshake_reply(struct ws_client *ws);
@ -61,4 +58,7 @@ ws_process_read_data(struct ws_client *ws, unsigned int *out_processed);
int
ws_frame_and_send_response(struct ws_client *ws, enum ws_frame_type type, const char *p, size_t sz);
void
ws_close_if_able(struct ws_client *ws);
#endif

@ -79,7 +79,7 @@ worker_can_read(int fd, short event, void *p) {
int reply_ret = ws_handshake_reply(c->ws);
if(reply_ret < 0) {
c->ws->http_client = NULL; /* detach to prevent double free */
ws_client_free(c->ws);
ws_close_if_able(c->ws);
c->broken = 1;
} else {
unsigned int processed = 0;

Loading…
Cancel
Save