Make logging more uniform. Fix copyright year
[umurmur.git] / src / server.c
index 7cabfb37aca8e5926f06db84577d923732fae87e..05bcba572667643a1aa9124bdfe3d573b9a946a4 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2009, Thorvald Natvig <thorvald@natvig.com>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
+   Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
 
 #include "conf.h"
 #include "log.h"
 #include "timer.h"
+#include "version.h"
 
 #define LISTEN_SOCK 0
 #define TCP_SOCK 0
 #define UDP_SOCK 1
 
-int udpsock; /* XXX restructure! */
+/* globals */
+int udpsock; 
 bool_t shutdown_server;
 
 void Server_run()
@@ -109,6 +111,9 @@ void Server_run()
        
        Timer_init(&janitorTimer);
        
+       Log_info("uMurmur version %s protocol version %d.%d.%d -- http://code.google.com/p/umurmur/",
+                        UMURMUR_VERSION, PROTVER_MAJOR, PROTVER_MINOR, PROTVER_PATCH);
+
        /* Main server loop */
        while (!shutdown_server) {
                struct sockaddr_in remote;
@@ -144,8 +149,8 @@ void Server_run()
                        tcpfd = accept(pollfds[LISTEN_SOCK].fd, (struct sockaddr*)&remote, &addrlen);
                        fcntl(tcpfd, F_SETFL, O_NONBLOCK);
                        setsockopt(tcpfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
-                       Log_info("Connection from %s port %d\n", inet_ntoa(remote.sin_addr),
-                                        ntohs(remote.sin_port));
+                       Log_debug("Connection from %s port %d\n", inet_ntoa(remote.sin_addr),
+                                         ntohs(remote.sin_port));
                        Client_add(tcpfd, &remote);
                }