Skip to content

Commit 3b7392e

Browse files
committed
wip
1 parent 8579d63 commit 3b7392e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

plugins/in_forward/fw_conn.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,26 @@ int fw_conn_event(void *data)
4545

4646
conn = connection->user_data;
4747

48+
/* Check if connection is still valid */
49+
if (!conn) {
50+
return -1;
51+
}
52+
4853
ctx = conn->ctx;
4954

55+
/*
56+
* Acquire mutex to check if plugin is paused.
57+
* If paused, the connection may have been deleted, so exit early.
58+
*/
59+
pthread_mutex_lock(&ctx->conn_mutex);
60+
61+
if (ctx->is_paused) {
62+
pthread_mutex_unlock(&ctx->conn_mutex);
63+
return -1;
64+
}
65+
66+
pthread_mutex_unlock(&ctx->conn_mutex);
67+
5068
event = &connection->event;
5169

5270
if (event->mask & MK_EVENT_READ) {

0 commit comments

Comments
 (0)