Skip to content

Commit

Permalink
Update mk_scheduler.c
Browse files Browse the repository at this point in the history
  • Loading branch information
obs-gh-arvindsrinivasan committed Oct 6, 2023
1 parent da569ea commit a157e6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/monkey/mk_server/mk_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern struct mk_sched_handler mk_http2_handler;

pthread_mutex_t mutex_worker_init = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex_worker_exit = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex_conn_timeout = PTHREAD_MUTEX_INITIALIZER;

/*
* Returns the worker id which should take a new incomming connection,
Expand Down Expand Up @@ -238,7 +239,9 @@ struct mk_sched_conn *mk_sched_add_connection(int remote_fd,
* The protocol handler is in charge to remove the session from the
* timeout_queue.
*/
pthread_mutex_lock(&mutex_conn_timeout);
mk_sched_conn_timeout_add(conn, sched);
pthread_mutex_unlock(&mutex_conn_timeout);

/* Linux trace message */
MK_LT_SCHED(remote_fd, "REGISTERED");
Expand Down Expand Up @@ -540,7 +543,9 @@ int mk_sched_remove_client(struct mk_sched_conn *conn,

/* Unlink from the red-black tree */
//rb_erase(&conn->_rb_head, &sched->rb_queue);
pthread_mutex_lock(&mutex_conn_timeout);
mk_sched_conn_timeout_del(conn);
pthread_mutex_unlock(&mutex_conn_timeout);

/* Close at network layer level */
conn->net->close(conn->net->plugin, event->fd);
Expand Down

0 comments on commit a157e6e

Please sign in to comment.