Fixed log

This commit is contained in:
vysheng 2013-12-18 19:42:53 +04:00
parent 28dd0f0e46
commit 16c49b539d

4
net.c
View File

@ -358,7 +358,7 @@ void try_write (struct connection *c) {
while (c->out_head) {
int r = write (c->fd, c->out_head->rptr, c->out_head->wptr - c->out_head->rptr);
if (r > 0 && log_net_f) {
fprintf (log_net_f, "OUT %s:%d", c->ip, c->port);
fprintf (log_net_f, "%d %d OUT %s:%d", (int)time (0), r, c->ip, c->port);
int i;
for (i = 0; i < r; i++) {
fprintf (log_net_f, " %02x", *(unsigned char *)(c->out_head->rptr + i));
@ -469,7 +469,7 @@ void try_read (struct connection *c) {
while (1) {
int r = read (c->fd, c->in_tail->wptr, c->in_tail->end - c->in_tail->wptr);
if (r > 0 && log_net_f) {
fprintf (log_net_f, "IN %s:%d", c->ip, c->port);
fprintf (log_net_f, "%d %d IN %s:%d", (int)time (0), r, c->ip, c->port);
int i;
for (i = 0; i < r; i++) {
fprintf (log_net_f, " %02x", *(unsigned char *)(c->in_tail->wptr + i));