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; double admissions_estimate = (double)estimated_execution / module->relative_deadline;
/*
* Reject Requests that exceed system capacity
*/
if (runtime_admitted + admissions_estimate >= runtime_worker_threads_count) { if (runtime_admitted + admissions_estimate >= runtime_worker_threads_count) {
/* Reject Requests that exceed system capacity */
send(socket_descriptor, HTTP_RESPONSE_504_SERVICE_UNAVAILABLE, send(socket_descriptor, HTTP_RESPONSE_504_SERVICE_UNAVAILABLE,
strlen(HTTP_RESPONSE_504_SERVICE_UNAVAILABLE), 0); strlen(HTTP_RESPONSE_504_SERVICE_UNAVAILABLE), 0);
goto done; } else {
}
/* Allocate a Sandbox Request */ /* Allocate a Sandbox Request */
struct sandbox_request *sandbox_request = struct sandbox_request *sandbox_request =
sandbox_request_allocate(module, module->name, socket_descriptor, sandbox_request_allocate(module, module->name, socket_descriptor,
(const struct sockaddr *)&client_address, request_arrival_timestamp, (const struct sockaddr *)&client_address,
admissions_estimate); request_arrival_timestamp, admissions_estimate);
assert(sandbox_request); assert(sandbox_request);
/* Add to the Global Sandbox Request Scheduler */ /* Add to the Global Sandbox Request Scheduler */
@ -135,11 +131,12 @@ listener_thread_main(void *dummy)
/* Add to work accepted by the runtime */ /* Add to work accepted by the runtime */
runtime_admitted += admissions_estimate; 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); free(epoll_events);
return NULL; return NULL;
} }

Loading…
Cancel
Save