Commit 24331ad8 authored by Michael Reese's avatar Michael Reese

socket: add disable_timeout flag to socket structure to prevent checking for…

socket: add disable_timeout flag to socket structure to prevent checking for environment variable all the  time
parent 726fd2f7
......@@ -843,8 +843,7 @@ static eb_status_t eb_sdb_find_by_identity_real(
*devices = record.fill_output;
// intercept all timeouts if this environment variable is set
const char *eb_disable_all_timeouts = getenv("EB_DISABLE_ALL_TIMEOUTS");
if (eb_disable_all_timeouts != NULL && record.status == EB_TIMEOUT) {
if (getenv("EB_DISABLE_ALL_TIMEOUTS") != NULL && record.status == EB_TIMEOUT) {
return EB_OK;
}
return record.status;
......
......@@ -138,6 +138,10 @@ eb_status_t eb_socket_open(uint16_t abi_code, const char* port, eb_width_t suppo
socket->last_response = EB_NULL;
socket->widths = supported_widths;
socket->aux = auxp;
socket->disable_all_timeouts = 0;
if (getenv("EB_DISABLE_ALL_TIMEOUTS") != NULL) {
socket->disable_all_timeouts = 1;
}
aux = EB_SOCKET_AUX(auxp);
aux->time_cache = 0;
......@@ -386,7 +390,7 @@ int eb_socket_check(eb_socket_t socketp, uint32_t now, eb_user_data_t user, eb_d
completed = 0;
/* Step 1. Kill any expired timeouts */
if (getenv("EB_DISABLE_ALL_TIMEOUTS") == NULL) {
if (!socket->disable_all_timeouts) {
while (socket->first_response != EB_NULL &&
eb_socket_timeout(socketp) <= now) {
/* Kill first */
......
......@@ -72,6 +72,7 @@ struct eb_socket {
eb_socket_aux_t aux;
uint8_t widths;
uint8_t disable_all_timeouts;
};
/* Invert last_response, suitable for attaching to the end of first_response */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment