Insert fake events under a lock
The thread-specific spinlock needs to be acquired before a fake event is inserted from a non-polling thread. The usual situation is when a monitor thread inserts a hangup event for a DCB. Other, less common cases are when session timeouts have been enabled and the DCB needs to be closed. Here it is better to insert a fake hangup event instead of directly closing the DCB from an external thread.
This commit is contained in:
@ -42,6 +42,7 @@
|
||||
#include <maxscale/atomic.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/housekeeper.h>
|
||||
#include <maxscale/poll.h>
|
||||
|
||||
/* This list of all sessions */
|
||||
LIST_CONFIG SESSIONlist =
|
||||
@ -927,7 +928,7 @@ void process_idle_sessions()
|
||||
if (all_session->service && all_session->client_dcb && all_session->client_dcb->state == DCB_STATE_POLLING &&
|
||||
hkheartbeat - all_session->client_dcb->last_read > all_session->service->conn_idle_timeout * 10)
|
||||
{
|
||||
dcb_close(all_session->client_dcb);
|
||||
poll_fake_hangup_event(all_session->client_dcb);
|
||||
}
|
||||
|
||||
current = list_iterate(&SESSIONlist, current);
|
||||
|
Reference in New Issue
Block a user