server/red_channel: add public red_channel_default_peer_on_error

for later use in red_worker
This commit is contained in:
Alon Levy 2010-11-07 12:42:38 +02:00
parent c322873cf0
commit 33bede823a
2 changed files with 5 additions and 5 deletions

View File

@ -185,10 +185,8 @@ static void red_peer_handle_outgoing(RedsStreamContext *peer, OutgoingHandler *h
}
}
static void red_channel_peer_on_error(void *opaque)
void red_channel_default_peer_on_error(RedChannel *channel)
{
RedChannel *channel = (RedChannel *)opaque;
channel->disconnect(channel);
}
@ -286,7 +284,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer,
channel->incoming.alloc_msg_buf = (alloc_msg_recv_buf_proc)alloc_recv_buf;
channel->incoming.release_msg_buf = (release_msg_recv_buf_proc)release_recv_buf;
channel->incoming.handle_message = (handle_message_proc)handle_message;
channel->incoming.on_error = red_channel_peer_on_error;
channel->incoming.on_error = (on_incoming_error_proc)red_channel_default_peer_on_error;
channel->outgoing.opaque = channel;
channel->outgoing.pos = 0;
@ -296,7 +294,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer,
channel->outgoing.get_msg_size = red_channel_peer_get_out_msg_size;
channel->outgoing.prepare = red_channel_peer_prepare_out_msg;
channel->outgoing.on_block = red_channel_peer_on_out_block;
channel->outgoing.on_error = red_channel_peer_on_error;
channel->outgoing.on_error = (on_outgoing_error_proc)red_channel_default_peer_on_error;
channel->outgoing.on_msg_done = red_channel_peer_on_out_msg_done;
channel->shut = 0; // came here from inputs, perhaps can be removed? XXX

View File

@ -200,6 +200,8 @@ void red_channel_init_outgoing_messages_window(RedChannel *channel);
int red_channel_handle_message(RedChannel *channel, uint32_t size,
uint16_t type, void *message);
/* default error handler that disconnects channel */
void red_channel_default_peer_on_error(RedChannel *channel);
/* when preparing send_data: should call reset, then init and then add_buf per buffer that is
being sent */