mirror of
https://github.com/nasa/trick.git
synced 2025-01-03 03:46:44 +00:00
Now exiting if we can't listen on requested port.
This commit is contained in:
parent
2f71740f1a
commit
973eaf738b
@ -55,8 +55,9 @@ void* start_civet(void* obj)
|
|||||||
server->ctx = mg_start(&callbacks, 0, options);
|
server->ctx = mg_start(&callbacks, 0, options);
|
||||||
|
|
||||||
if (server->ctx == NULL) {
|
if (server->ctx == NULL) {
|
||||||
message_publish(MSG_ERROR, "Trick Webserver: Failed to create listener.\n"
|
message_publish(MSG_ERROR, "Trick Webserver: Failed to create listener, exiting Simulation.\n"
|
||||||
"Perhaps another program is already using port %s.\n", port);
|
"Perhaps another program is already using port %i.\n", server->port);
|
||||||
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,8 +118,7 @@ void* main_loop(void* S) {
|
|||||||
bool messageSent;
|
bool messageSent;
|
||||||
int rc = pthread_create(&civet_thread, NULL, start_civet, S);
|
int rc = pthread_create(&civet_thread, NULL, start_civet, S);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
message_publish(MSG_ERROR, "Trick Webserver: Failed to create listener.\n"
|
//TODO: Put error message here
|
||||||
"Perhaps another program is already using port %s.\n");
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,6 @@ int MyCivetServer::init() {
|
|||||||
int rc;
|
int rc;
|
||||||
rc = pthread_create(&server_thread, NULL, main_loop, (void*)this);
|
rc = pthread_create(&server_thread, NULL, main_loop, (void*)this);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
//TODO: Put a error message here
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
message_publish(MSG_INFO, "Trick Webserver: Listening on port. %i\n", port);
|
message_publish(MSG_INFO, "Trick Webserver: Listening on port. %i\n", port);
|
||||||
|
Loading…
Reference in New Issue
Block a user