Revision 25
moved more code around
ColonetServer.cpp | ||
---|---|---|
53 | 53 |
return 0; |
54 | 54 |
} |
55 | 55 |
|
56 |
int ColonetServer::start_listening() { |
|
57 |
if (listen(listen_socket, LISTEN_BACKLOG) < 0) { |
|
58 |
log_error("\t\nThere was an error telling the socket to " |
|
59 |
"listen for connections from clients. Terminating Server...\n"); |
|
60 |
return -1; |
|
61 |
} |
|
62 |
return 0; |
|
63 |
} |
|
56 | 64 |
|
57 | 65 |
int ColonetServer::log_error(char * error_message) { |
58 | 66 |
return logger.logMessage(LOG_TYPE_ERROR, error_message); |
... | ... | |
135 | 143 |
return &connection_pool; |
136 | 144 |
} |
137 | 145 |
|
138 |
int ColonetServer::get_listen_socket() { |
|
139 |
return listen_socket; |
|
140 |
} |
|
141 |
|
|
142 | 146 |
int ColonetServer::initialize_wireless() |
143 | 147 |
{ |
144 | 148 |
char* log_filename = NULL; |
... | ... | |
214 | 218 |
return -1; |
215 | 219 |
} |
216 | 220 |
|
217 |
if (listen(colonet_server.get_listen_socket(), LISTEN_BACKLOG) < 0) { |
|
218 |
colonet_server.log_error("\t\nThere was an error telling the socket to " |
|
219 |
"listen for connections from clients. Terminating Server...\n"); |
|
221 |
if (colonet_server.start_listening() < 0) { |
|
220 | 222 |
return -1; |
221 | 223 |
} |
222 |
|
|
224 |
|
|
223 | 225 |
colonet_server.run_server(); |
224 | 226 |
|
225 | 227 |
return 0; |
Also available in: Unified diff