Project

General

Profile

Revision 391

some cleanup in colonetserver

View differences:

ColonetServer.cpp
18 18

  
19 19
#include <colonet_wireless.h>
20 20

  
21
#include "includes/ColonetServer.h"
22
#include "includes/ConnectionPool.h"
23
#include "includes/wirelessMessageHandler.h"
24
#include "includes/options.h"
25
#include "includes/Log.h"
21
#include <ColonetServer.h>
22
#include <ConnectionPool.h>
23
#include <wirelessMessageHandler.h>
24
#include <options.h>
25
#include <Log.h>
26 26

  
27 27
#define LISTEN_BACKLOG 5
28 28
#define LOG_BUFFER_LENGTH 128
29 29

  
30 30
#define u_int32_t unsigned
31 31

  
32
ConnectionPool * connection_pool;
32
static ConnectionPool * connection_pool;
33 33

  
34 34
/**
35 35
 * @brief Default constructor for ColonetServer
......
53 53
 * @return 0 on success, negative error code on failure
54 54
 */
55 55
int ColonetServer::initialize_server(int argc, char * argv[]) {
56
  printf("Initializing Server...\n");
57

  
58 56
  parseCmdLine(argc, argv);
59 57

  
60 58
  if (initialize_connection(optionsG.listen_port) < 0) {
......
217 215

  
218 216
  //get a socket fd
219 217
  if ((listen_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
220
    printf("\tThere was an error creating a socket\n");
218
    printf("\tThere was an error creating  socket\n");
221 219
    return -1;
222 220
  }
223 221

  
......
250 248

  
251 249
  return 0;
252 250
}
253

  
254
/**
255
 * @brief The main function of the server
256
 *
257
 * @param argc The number of command line arguments passed to the program
258
 * @param argv The command line arguments passed to the program
259
 *
260
 * @return 0 on success, negative error code on error
261
 */
262
ColonetServer colonet_server;
263
int main(int argc, char** argv) {
264

  
265
  if (colonet_server.initialize_server(argc, argv) < 0) {
266
    printf("\t\nThere was an error initializing the server. "
267
	   "Terminating server...\n");
268
    return -1;
269
  }
270

  
271
  if (colonet_server.start_listening() < 0) {
272
    return -1;
273
  }
274

  
275
  colonet_server.run_server();
276

  
277
  return 0;
278
}

Also available in: Unified diff