add: lock_get( msg_lock ); cur_queued_size += buf->len; if (max_queued_size<cur_queued_size) max_queued_size=cur_queued_size; cur_queued_units++; if (max_queued_units<cur_queued_units) max_queued_units=cur_queued_units; lock_release( msg_lock );
context: int put_in_queue( str *buf, struct peer *p){	struct queue_unit qu;	qu.buf.s   = buf->s;	qu.buf.len = buf->len;	qu.p       = p;	if (write( msg_pipe[1], &qu, sizeof(qu) )!=sizeof(qu) ) {		LOG(L_ERR,"ERROR:put_in_queue: cannot write into pipe : %s\n",			strerror(errno));		return -1;	}	return 1;}