Improve handleError error messages
The hangup and error handlers now have unique messages. Although the behavior in the handlers is practically the same in both cases, the cause of the error is not the same. If a socket error is present, it is added to the error message. If an error is present, it should clearly show the reason why the TCP socket was closed. The is_fake_event boolean helps distinguish fake events from real ones. This makes figuring out the real source of hangup events easier.
This commit is contained in:
@ -204,6 +204,7 @@ DCB* dcb_alloc(dcb_role_t role, SERV_LISTENER* listener)
|
||||
newdcb->low_water = config_writeq_low_water();
|
||||
newdcb->high_water = config_writeq_high_water();
|
||||
newdcb->m_uid = this_unit.uid_generator.fetch_add(1, std::memory_order_relaxed);
|
||||
newdcb->is_fake_event = false;
|
||||
|
||||
if (role == DCB_ROLE_SERVICE_LISTENER)
|
||||
{
|
||||
@ -2062,7 +2063,9 @@ static void dcb_hangup_foreach_worker(MXB_WORKER* worker, struct server* server)
|
||||
{
|
||||
this_thread.current_dcb = dcb;
|
||||
dcb->flags |= DCBF_HUNG;
|
||||
dcb->is_fake_event = true;
|
||||
dcb->func.hangup(dcb);
|
||||
dcb->is_fake_event = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3249,7 +3252,9 @@ static uint32_t dcb_handler(DCB* dcb, uint32_t events)
|
||||
events = dcb->fake_event;
|
||||
dcb->fake_event = 0;
|
||||
|
||||
dcb->is_fake_event = true;
|
||||
rv |= dcb_process_poll_events(dcb, events);
|
||||
dcb->is_fake_event = false;
|
||||
}
|
||||
|
||||
this_thread.current_dcb = NULL;
|
||||
|
Reference in New Issue
Block a user