projects
/
umurmur.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #62 from marcusball/master
[umurmur.git]
/
src
/
log.c
diff --git
a/src/log.c
b/src/log.c
index 17bbe14a56e804bd9aea4b9b68475e06a3cbc088..91ec5b023ed40e0de5d8e407553114fc0f9d78f7 100644
(file)
--- a/
src/log.c
+++ b/
src/log.c
@@
-39,6
+39,7
@@
#include "log.h"
#include "conf.h"
#include "log.h"
#include "conf.h"
+#include "util.h"
#define STRSIZE 254
#define STRSIZE 254
@@
-182,7
+183,6
@@
void Log_info_client(client_t *client, const char *logstring, ...)
va_list argp;
char buf[STRSIZE + 1];
int offset = 0;
va_list argp;
char buf[STRSIZE + 1];
int offset = 0;
- uint16_t port;
if (termprint || logfile)
offset = sprintf(buf, "INFO: ");
if (termprint || logfile)
offset = sprintf(buf, "INFO: ");
@@
-191,16
+191,13
@@
void Log_info_client(client_t *client, const char *logstring, ...)
offset += vsnprintf(&buf[offset], STRSIZE - offset, logstring, argp);
va_end(argp);
offset += vsnprintf(&buf[offset], STRSIZE - offset, logstring, argp);
va_end(argp);
- if(client->remote_tcp.ss_family == AF_INET)
- port = ntohs(((struct sockaddr_in*)&client->remote_tcp)->sin_port);
- else
- port = ntohs(((struct sockaddr_in6*)&client->remote_tcp)->sin6_port);
-
+ char *clientAddressString = Util_clientAddressToString(client);
offset += snprintf(&buf[offset], STRSIZE - offset, " - [%d] %s@%s:%d",
offset += snprintf(&buf[offset], STRSIZE - offset, " - [%d] %s@%s:%d",
- client->sessionId,
- client->username == NULL ? "" : client->username,
- client->addressString,
- port);
+ client->sessionId,
+ client->username == NULL ? "" : client->username,
+ clientAddressString,
+ Util_clientAddressToPortTCP(client));
+ free(clientAddressString);
if (termprint)
fprintf(stderr, "%s\n", buf);
if (termprint)
fprintf(stderr, "%s\n", buf);