Make logging more uniform. Fix copyright year
authorfatbob313 <martin@fatbob.nu>
Sat, 16 Jan 2010 22:00:10 +0000 (22:00 +0000)
committerfatbob313 <martin@fatbob.nu>
Sat, 16 Jan 2010 22:00:10 +0000 (22:00 +0000)
26 files changed:
src/Makefile
src/channel.c
src/channel.h
src/client.c
src/client.h
src/conf.c
src/conf.h
src/crypt.c
src/crypt.h
src/log.c
src/log.h
src/main.c
src/messagehandler.c
src/messagehandler.h
src/messages.c
src/messages.h
src/pds.c
src/pds.h
src/server.c
src/server.h
src/ssl.c
src/ssl.h
src/timer.c
src/timer.h
src/voicetarget.c
src/voicetarget.h

index f3856d9b52a9cd2d9a4d41edbb8a25ad185a10a8..95b8ed1629f4d822cd7687d1c5846207c23c3176 100644 (file)
@@ -2,7 +2,7 @@ SRCS:=client.c main.c messages.c pds.c server.c ssl.c log.c conf.c crypt.c \
        timer.c messagehandler.c channel.c Mumble.pb-c.c voicetarget.c
 
 OBJS:=$(patsubst %.c, %.o, $(SRCS))
-#CFLAGS:=$(CFLAGS) -I. -I/data/export/proj/openssl/include/ -Wall -g -DDEBUG
+CFLAGS:=$(CFLAGS) -I. -I/data/export/proj/openssl/include/ -Wall -g -DDEBUG
 #LDFLAGS:=$(LDFLAGS) -L/data/export/proj/openssl/lib/ -lcrypto -lssl -lconfig
 CFLAGS:=$(CFLAGS) -I. -Wall -g
 LDFLAGS:=$(LDFLAGS) -lcrypto -lssl -lconfig
index 5476b1d92ae921be82583b9b0480d52727f301b0..1c0b1604cc59e49fa0e590cd767a5292f5e86888 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index c8896612fb28a0fc88f74bd700241e933d02355a..d63d53262c21d9299ad63fc9eef68183847de14e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index cb7452e3dafd710993dbfa81b6612e44a3e1c4e2..26daca8cd58df0ae33d87b1f822528018df7cf95 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
@@ -97,7 +97,11 @@ void Client_janitor()
                
                if (Timer_isElapsed(&c->lastActivity, 1000000LL * INACTICITY_TIMEOUT)) {
                        /* No activity from client - assume it is lost and close. */
-                       Log_info("Session ID %d timeout - closing", c->sessionId);
+                       Log_info("Timeout, closing session %d - %s@%s:%d",
+                                        c->sessionId,
+                                        c->playerName,
+                                        inet_ntoa(c->remote_tcp.sin_addr),
+                                        ntohs(c->remote_tcp.sin_port));
                        Client_free(c);
                }
        }
@@ -208,7 +212,9 @@ void Client_free(client_t *client)
        struct dlist *itr, *save;
        message_t *sendmsg;
 
-       Log_info("Disconnect client ID %d addr %s port %d", client->sessionId,
+       Log_info("Disconnect session %d - %s@%s:%d",
+                        client->sessionId,
+                        client->playerName,
                         inet_ntoa(client->remote_tcp.sin_addr),
                         ntohs(client->remote_tcp.sin_port));
 
@@ -347,7 +353,11 @@ int Client_read(client_t *client)
                                        /* Hmm. This is where we end up when the client closes its connection.
                                         * Kind of strange...
                                         */
-                                       Log_info("Connection closed by peer");
+                                       Log_info("Connection closed by peer. Session %d - %s@%s:%d",
+                                                        client->sessionId,
+                                                        client->playerName,
+                                                        inet_ntoa(client->remote_tcp.sin_addr),
+                                                        ntohs(client->remote_tcp.sin_port));
                                }
                                else {
                                        Log_warn("SSL error: %d - Closing connection.", SSL_get_error(client->ssl, rc));
@@ -504,7 +514,12 @@ static bool_t checkDecrypt(client_t *client, const uint8_t *encrypted, uint8_t *
                        Timer_restart(&client->cryptState.tLastRequest);
                        
                        sendmsg = Msg_create(CryptSetup);
-                       Log_info("Requesting voice channel crypt resync");
+                       Log_info("Requesting voice channel crypt resync. Session %d - %s@%s:%d",
+                                        client->sessionId,
+                                        client->playerName,
+                                        inet_ntoa(client->remote_tcp.sin_addr),
+                                        ntohs(client->remote_tcp.sin_port));
+               
                        Client_send_message(client, sendmsg);
                }
        }
@@ -569,7 +584,11 @@ int Client_read_udp()
                        if (itr->remote_tcp.sin_addr.s_addr == from.sin_addr.s_addr) {
                                if (checkDecrypt(itr, encrypted, buffer, len)) {
                                        itr->key = key;
-                                       Log_info("New UDP connection from %s port %d sessionId %d", inet_ntoa(from.sin_addr), ntohs(from.sin_port), itr->sessionId);
+                                       Log_info("New UDP connection from session %d - %s@%s:%d",
+                                                        itr->sessionId,
+                                                        itr->playerName,
+                                                        inet_ntoa(from.sin_addr),
+                                                        ntohs(from.sin_port));
                                        memcpy(&itr->remote_udp, &from, sizeof(struct sockaddr_in));
                                        break;
                                }
index 1239e557842181dc6fed7b5c46d5d4baaf4a458a..82792e9924312f9edb17b0065d0dbdadc7b0a54a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 3068cd7f1785e2e46759130fe524a35bcbab8b03..ae91b6e18076cff50dcb67e6d2de086e734b6e7a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 5b08c39c721fa1047de1d9e72837287e32867b75..c0a0825c47702c0e4bd68c5f3c08cd610f6346a2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 7d370d0ee11c8f74d24a982ff9fdf9099f1eeba3..e69d34e4524269d8d1cde279fecb496e2bb49d7e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 0b35ac3b18d56c2f855e57b61eb54ed590d82bc0..8e95fe2f8dbaaa6fd663ab3a33afcae77a54bd55 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 9eb5981d1ea9d01a67683fbf0d24109018e1dd9e..f4a0ea117233f9e8bdd7a97dc35861a6d3eaae8c 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index dd323421bce6fbbaa858512789cb98ac9e2f2374..c724158fa65f07b87bbe70734b8cad4c82cb2950 100644 (file)
--- a/src/log.h
+++ b/src/log.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index d6342f1d728cb4e387625b1014737029ff0ace64..6d48f6e4656fd01544a6cb725c612e582237ca23 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 089aec0a56ae6b890ee26ba51cd5b0b68b625613..ceff99b6c7a0f73e4cde3a5363d592bd6e5616b6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
@@ -51,6 +51,14 @@ static void sendServerReject(client_t *client, const char *reason, MumbleProto__
        msg->payload.reject->type = type;
        msg->payload.reject->has_type = true;
        Client_send_message(client, msg);
+       
+       Log_info("Server reject reason: %s. Disconnecting session %d - %s@%s:%d",
+                        reason,
+                        client->sessionId,
+                        client->playerName,
+                        inet_ntoa(client->remote_tcp.sin_addr),
+                        ntohs(client->remote_tcp.sin_port));
+       
 }
 
 static void sendPermissionDenied(client_t *client, const char *reason)
@@ -217,7 +225,7 @@ void Mh_handle_message(client_t *client, message_t *msg)
                        sendmsg->payload.userState->has_channel_id = true;
                        sendmsg->payload.userState->channel_id = ((channel_t *)client_itr->channel)->id;
 
-                       /* XXX - check if self_* is correct */
+                       /* Only self_mute/deaf supported */
                        if (client_itr->deaf) {
                                sendmsg->payload.userState->has_self_deaf = true;
                                sendmsg->payload.userState->self_deaf = true;
index ad11a59a93e8e4d657315594c0198b964ac1164c..727a2ec60ec14b5f678a9d88068e923e44ca480f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index b290257c1e4d24c35580761f63343e34b1a5800d..b1e76f9b908c08846ba347f73ca279abf47edf8e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index c163c6229bbe5e2a21424a1524e1f62f2d0f94e7..4899a085d0d5756882e8ce4a08394d288252d848 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 3a57954f68f3318688f55b0aad19f37923a843e1..0563c53653515d793c5be5c741809f8844bfb2b5 100644 (file)
--- a/src/pds.c
+++ b/src/pds.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index d3f12748533c17033611aaa2e4ae012e5234f93a..8bb05abcb85844c2a11569dc254df495e6c11c93 100644 (file)
--- a/src/pds.h
+++ b/src/pds.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index ff20f81795b968adbca5b80cf7aa1335b310b74a..05bcba572667643a1aa9124bdfe3d573b9a946a4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* 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,7 +111,8 @@ void Server_run()
        
        Timer_init(&janitorTimer);
        
-       Log_info("uMurmur voicechat server started -- http://code.google.com/p/umurmur/");
+       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) {
@@ -146,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);
                }
 
index 9fd01b8f362ca40123d88a804b3c13e9dcc07031..5eb13776de9c84d0283a64bf8b8edffaaa68d01a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 1ef4892b965cc7c313e5cdab8e1df80e640ab06d..a4c860f7b0e5e0b0b2f6f04599acb0cb2104ff12 100644 (file)
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 4b8ac33672e58bf9eb0878bb5c616c35fc9aa966..2c47f83d1411ded5d47a92e5dee8da3515650533 100644 (file)
--- a/src/ssl.h
+++ b/src/ssl.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 53a63c9d58b85b5bb62b61e09e717feacb0cdec9..8889109b7fcd5cedf9bd5e95b0165768643ef9ca 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index e0669376a03f880a962a5b84a89127a7e5c557eb..b19c7d8b55b6716308c2a2582c7c201da1c6b32d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, Martin Johansson <martin@fatbob.nu>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
    Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
index 3a8e0fd4eab353b19e601fbfdb1fdb49c566d86d..935139fd2fb8c7080e9773771bb5be5a3e46af8f 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.
 
index fa8af04c33ce3316c5f42bd15235fd9c55a70461..0d2f05106d0c5da0acb58813cbf5efa0daeca5c2 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.