aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/conversation_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-19 18:50:00 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-19 18:50:00 +0000
commit2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd (patch)
tree58be8b2e7321a91015df8ab3281a9f89a26cec1f /src/conversation/conversation_api.c
parentd8d3021ad9af2abe551fd6cd0fe2529a99d3683c (diff)
downloadgnunet-2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd.tar.gz
gnunet-2042d867f71e3cb1d7ade6b3d474ce0c1f5f87bd.zip
redefine GNUNET_MQ_queue_for_connection_client to capture client handle
Diffstat (limited to 'src/conversation/conversation_api.c')
-rw-r--r--src/conversation/conversation_api.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index a9dc1f27f..3e0db67ea 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -161,11 +161,6 @@ struct GNUNET_CONVERSATION_Phone
161 const struct GNUNET_CONFIGURATION_Handle *cfg; 161 const struct GNUNET_CONFIGURATION_Handle *cfg;
162 162
163 /** 163 /**
164 * Handle to talk with CONVERSATION service.
165 */
166 struct GNUNET_CLIENT_Connection *client;
167
168 /**
169 * We keep all callers in a DLL. 164 * We keep all callers in a DLL.
170 */ 165 */
171 struct GNUNET_CONVERSATION_Caller *caller_head; 166 struct GNUNET_CONVERSATION_Caller *caller_head;
@@ -562,6 +557,7 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone)
562 }; 557 };
563 struct GNUNET_MQ_Envelope *e; 558 struct GNUNET_MQ_Envelope *e;
564 struct ClientPhoneRegisterMessage *reg; 559 struct ClientPhoneRegisterMessage *reg;
560 struct GNUNET_CLIENT_Connection *client;
565 561
566 clean_up_callers (phone); 562 clean_up_callers (phone);
567 if (NULL != phone->mq) 563 if (NULL != phone->mq)
@@ -569,16 +565,12 @@ reconnect_phone (struct GNUNET_CONVERSATION_Phone *phone)
569 GNUNET_MQ_destroy (phone->mq); 565 GNUNET_MQ_destroy (phone->mq);
570 phone->mq = NULL; 566 phone->mq = NULL;
571 } 567 }
572 if (NULL != phone->client)
573 {
574 GNUNET_CLIENT_disconnect (phone->client);
575 phone->client = NULL;
576 }
577 phone->state = PS_REGISTER; 568 phone->state = PS_REGISTER;
578 phone->client = GNUNET_CLIENT_connect ("conversation", phone->cfg); 569 client = GNUNET_CLIENT_connect ("conversation",
579 if (NULL == phone->client) 570 phone->cfg);
571 if (NULL == client)
580 return; 572 return;
581 phone->mq = GNUNET_MQ_queue_for_connection_client (phone->client, 573 phone->mq = GNUNET_MQ_queue_for_connection_client (client,
582 handlers, 574 handlers,
583 &phone_error_handler, 575 &phone_error_handler,
584 phone); 576 phone);
@@ -644,7 +636,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
644 phone->my_record.line = htonl ((uint32_t) line); 636 phone->my_record.line = htonl ((uint32_t) line);
645 phone->my_record.version = htonl (0); 637 phone->my_record.version = htonl (0);
646 reconnect_phone (phone); 638 reconnect_phone (phone);
647 if ( (NULL == phone->client) || 639 if ( (NULL == phone->mq) ||
648 (NULL == phone->ns) ) 640 (NULL == phone->ns) )
649 { 641 {
650 GNUNET_break (0); 642 GNUNET_break (0);
@@ -764,11 +756,6 @@ GNUNET_CONVERSATION_phone_destroy (struct GNUNET_CONVERSATION_Phone *phone)
764 GNUNET_MQ_destroy (phone->mq); 756 GNUNET_MQ_destroy (phone->mq);
765 phone->mq = NULL; 757 phone->mq = NULL;
766 } 758 }
767 if (NULL != phone->client)
768 {
769 GNUNET_CLIENT_disconnect (phone->client);
770 phone->client = NULL;
771 }
772 GNUNET_free (phone); 759 GNUNET_free (phone);
773} 760}
774 761