Commit 16c49b53 authored by vysheng's avatar vysheng

Fixed log

parent 28dd0f0e
...@@ -358,7 +358,7 @@ void try_write (struct connection *c) { ...@@ -358,7 +358,7 @@ void try_write (struct connection *c) {
while (c->out_head) { while (c->out_head) {
int r = write (c->fd, c->out_head->rptr, c->out_head->wptr - c->out_head->rptr); int r = write (c->fd, c->out_head->rptr, c->out_head->wptr - c->out_head->rptr);
if (r > 0 && log_net_f) { 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; int i;
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
fprintf (log_net_f, " %02x", *(unsigned char *)(c->out_head->rptr + i)); fprintf (log_net_f, " %02x", *(unsigned char *)(c->out_head->rptr + i));
...@@ -469,7 +469,7 @@ void try_read (struct connection *c) { ...@@ -469,7 +469,7 @@ void try_read (struct connection *c) {
while (1) { while (1) {
int r = read (c->fd, c->in_tail->wptr, c->in_tail->end - c->in_tail->wptr); int r = read (c->fd, c->in_tail->wptr, c->in_tail->end - c->in_tail->wptr);
if (r > 0 && log_net_f) { 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; int i;
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
fprintf (log_net_f, " %02x", *(unsigned char *)(c->in_tail->wptr + i)); fprintf (log_net_f, " %02x", *(unsigned char *)(c->in_tail->wptr + i));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment