mirror of
https://github.com/lxsang/antd-tunnel-plugin
synced 2024-12-26 01:48:21 +01:00
Improvement stability
This commit is contained in:
parent
5219d6d037
commit
e1838b1f7f
BIN
dist/tunnel-0.1.0b.tar.gz
vendored
BIN
dist/tunnel-0.1.0b.tar.gz
vendored
Binary file not shown.
19
tunnel.c
19
tunnel.c
@ -612,6 +612,17 @@ static void handle_channel(bst_node_t *node, void **args, int argc)
|
||||
if (write_msg_to_client(&msg, rq) != 0)
|
||||
{
|
||||
ERROR("Unable to send CTRL command to client");
|
||||
// remove the client from the list
|
||||
if (msg.header.type != CHANNEL_UNSUBSCRIBE)
|
||||
{
|
||||
// tell the other endpoint to remove the subscriber
|
||||
msg.header.type = CHANNEL_UNSUBSCRIBE;
|
||||
msg.header.size = 0;
|
||||
if (msg_write(channel->sock, &msg) == -1)
|
||||
{
|
||||
ERROR("Unable to send unsubscribe notification to channel %s (%d)", channel->name, channel->sock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -784,6 +795,14 @@ static void process_client_message(antd_tunnel_msg_t *msg, antd_client_t *client
|
||||
if (msg_write(channel->sock, msg) == -1)
|
||||
{
|
||||
ERROR("Unable to write data to channel [%s] from client %d", channel->name, msg->header.client_id);
|
||||
// notify client to unsubscribe
|
||||
msg->header.type = CHANNEL_UNSUBSCRIBE;
|
||||
msg->header.size = 0;
|
||||
if (write_msg_to_client(msg, client) != 0)
|
||||
{
|
||||
ERROR("Unable to send unsubscribe message to client to client");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user