fix: correct control flow bug

main
Sean McBride 4 years ago
parent e445e76870
commit e430202c1f

@ -114,20 +114,16 @@ listener_thread_main(void *dummy)
double admissions_estimate = (double)estimated_execution / module->relative_deadline;
/*
* Reject Requests that exceed system capacity
*/
if (runtime_admitted + admissions_estimate >= runtime_worker_threads_count) {
/* Reject Requests that exceed system capacity */
send(socket_descriptor, HTTP_RESPONSE_504_SERVICE_UNAVAILABLE,
strlen(HTTP_RESPONSE_504_SERVICE_UNAVAILABLE), 0);
goto done;
}
} else {
/* Allocate a Sandbox Request */
struct sandbox_request *sandbox_request =
sandbox_request_allocate(module, module->name, socket_descriptor,
(const struct sockaddr *)&client_address, request_arrival_timestamp,
admissions_estimate);
(const struct sockaddr *)&client_address,
request_arrival_timestamp, admissions_estimate);
assert(sandbox_request);
/* Add to the Global Sandbox Request Scheduler */
@ -135,11 +131,12 @@ listener_thread_main(void *dummy)
/* Add to work accepted by the runtime */
runtime_admitted += admissions_estimate;
debuglog("Runtime Utilization: %f%%\n", runtime_admitted / runtime_worker_threads_count * 100);
debuglog("Runtime Utilization: %f%%\n",
runtime_admitted / runtime_worker_threads_count * 100);
}
}
}
done:
free(epoll_events);
return NULL;
}

Loading…
Cancel
Save