summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Perrin2012-10-22 06:58:39 (EDT)
committerDidier Brachet2012-10-23 08:26:39 (EDT)
commit49ac6260fe820c84c4060c4089b2c2ddfcc45487 (patch)
treeffa1ab8a92fe7bfe70c4a109c9ec465bbecd80fd
parentc69a1e511eff9b76d4ff0286c3a0eb7c7656cd0d (diff)
downloadorg.eclipse.tcf.agent-49ac6260fe820c84c4060c4089b2c2ddfcc45487.zip
org.eclipse.tcf.agent-49ac6260fe820c84c4060c4089b2c2ddfcc45487.tar.gz
org.eclipse.tcf.agent-49ac6260fe820c84c4060c4089b2c2ddfcc45487.tar.bz2
Bug 392563 - Prevent multiple registrations of channel close listener.
-rw-r--r--agent/tcf/services/streamsservice.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/agent/tcf/services/streamsservice.c b/agent/tcf/services/streamsservice.c
index 12869b0..125e6a4 100644
--- a/agent/tcf/services/streamsservice.c
+++ b/agent/tcf/services/streamsservice.c
@@ -927,13 +927,16 @@ static void channel_close_listener(Channel * c) {
void ini_streams_service(Protocol * proto) {
int i;
+ static int ini_streams = 0;
- for (i = 0; i < HANDLE_HASH_SIZE; i++) {
- list_init(&handle_hash[i]);
+ if (ini_streams == 0) {
+ for (i = 0; i < HANDLE_HASH_SIZE; i++) {
+ list_init(&handle_hash[i]);
+ }
+ add_channel_close_listener(channel_close_listener);
+ ini_streams = 1;
}
- add_channel_close_listener(channel_close_listener);
-
add_command_handler(proto, STREAMS, "subscribe", command_subscribe);
add_command_handler(proto, STREAMS, "unsubscribe", command_unsubscribe);
add_command_handler(proto, STREAMS, "read", command_read);