mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 22:45:07 -05:00
nts: disable input when sending data in NTS-KE session
Ignore read events when sending data to avoid spinning with blocked output.
This commit is contained in:
@@ -317,6 +317,15 @@ check_alpn(NKSN_Instance inst)
|
|||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_input_output(NKSN_Instance inst, int output)
|
||||||
|
{
|
||||||
|
SCH_SetFileHandlerEvent(inst->sock_fd, SCH_FILE_INPUT, !output);
|
||||||
|
SCH_SetFileHandlerEvent(inst->sock_fd, SCH_FILE_OUTPUT, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_state(NKSN_Instance inst, KeState state)
|
change_state(NKSN_Instance inst, KeState state)
|
||||||
{
|
{
|
||||||
@@ -338,7 +347,7 @@ change_state(NKSN_Instance inst, KeState state)
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_SetFileHandlerEvent(inst->sock_fd, SCH_FILE_OUTPUT, output);
|
set_input_output(inst, output);
|
||||||
|
|
||||||
inst->state = state;
|
inst->state = state;
|
||||||
}
|
}
|
||||||
@@ -406,8 +415,7 @@ handle_event(NKSN_Instance inst, int event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable output when the handshake is trying to receive data */
|
/* Disable output when the handshake is trying to receive data */
|
||||||
SCH_SetFileHandlerEvent(inst->sock_fd, SCH_FILE_OUTPUT,
|
set_input_output(inst, gnutls_record_get_direction(inst->tls_session));
|
||||||
gnutls_record_get_direction(inst->tls_session));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,8 +523,7 @@ handle_event(NKSN_Instance inst, int event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable output when the TLS shutdown is trying to receive data */
|
/* Disable output when the TLS shutdown is trying to receive data */
|
||||||
SCH_SetFileHandlerEvent(inst->sock_fd, SCH_FILE_OUTPUT,
|
set_input_output(inst, gnutls_record_get_direction(inst->tls_session));
|
||||||
gnutls_record_get_direction(inst->tls_session));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user