server/red_channel: add out_bytes_counter (unused)

This commit is contained in:
Alon Levy 2010-11-04 17:16:01 +02:00
parent bf6f246b2e
commit e571b5ebbb
2 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "stat.h"
#include "red_channel.h"
static void red_channel_push(RedChannel *channel);
@ -172,6 +173,7 @@ static void red_peer_handle_outgoing(RedsStreamContext *peer, OutgoingHandler *h
}
} else {
handler->pos += n;
stat_inc_counter(handler->out_bytes_counter, n);
if (handler->pos == handler->size) { // finished writing data
handler->on_msg_done(handler->opaque);
handler->vec = handler->vec_buf;
@ -285,6 +287,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer,
channel->outgoing.opaque = channel;
channel->outgoing.pos = 0;
channel->outgoing.size = 0;
channel->outgoing.out_bytes_counter = NULL;
channel->outgoing.get_msg_size = red_channel_peer_get_out_msg_size;
channel->outgoing.prepare = red_channel_peer_prepare_out_msg;

View File

@ -77,6 +77,9 @@ typedef struct OutgoingHandler {
on_outgoing_error_proc on_error;
on_outgoing_block_proc on_block;
on_outgoing_msg_done_proc on_msg_done;
#ifdef RED_STATISTICS
uint64_t *out_bytes_counter;
#endif
} OutgoingHandler;
/* Red Channel interface */