diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-29 18:53:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-29 18:53:57 +0000 |
commit | 81ae4871c8451e1eb3a5b270c30f4833d35845c2 (patch) | |
tree | d3fad208dd1a602ebd3b8d27576af6b4c58ab3a0 /src/core/core_api.c | |
parent | 91d4e478b4753b6dc9c3eb9d9eee3df22b120f69 (diff) | |
download | gnunet-81ae4871c8451e1eb3a5b270c30f4833d35845c2.tar.gz gnunet-81ae4871c8451e1eb3a5b270c30f4833d35845c2.zip |
hacky fix for cadet issues
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r-- | src/core/core_api.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index 4c55d0e5f..061a929e0 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -411,7 +411,7 @@ handle_init_reply (void *cls, | |||
411 | */ | 411 | */ |
412 | static void | 412 | static void |
413 | handle_connect_notify (void *cls, | 413 | handle_connect_notify (void *cls, |
414 | const struct ConnectNotifyMessage * cnm) | 414 | const struct ConnectNotifyMessage *cnm) |
415 | { | 415 | { |
416 | struct GNUNET_CORE_Handle *h = cls; | 416 | struct GNUNET_CORE_Handle *h = cls; |
417 | struct PeerRecord *pr; | 417 | struct PeerRecord *pr; |
@@ -713,6 +713,18 @@ handle_send_ready (void *cls, | |||
713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
714 | "Calling get_message with buffer of %u bytes\n", | 714 | "Calling get_message with buffer of %u bytes\n", |
715 | (unsigned int) th->msize); | 715 | (unsigned int) th->msize); |
716 | /* FIXME: this is ugly and a bit brutal, but "get_message" | ||
717 | may call GNUNET_CORE_notify_transmit_ready() which | ||
718 | may call GNUNET_MQ_send() as well, and we MUST get this | ||
719 | message out before the next SEND_REQUEST. So we queue | ||
720 | it (even though incomplete) and then---relying on MQ being | ||
721 | nice and not actually touching 'env' until much later--- | ||
722 | fill it afterwards. This is horrible style, and once | ||
723 | the core_api abandons GNUNET_CORE_notify_transmit_ready | ||
724 | in favor of an MQ-style API, this hack should no longer | ||
725 | be required */ | ||
726 | GNUNET_MQ_send (h->mq, | ||
727 | env); | ||
716 | ret = th->get_message (th->get_message_cls, | 728 | ret = th->get_message (th->get_message_cls, |
717 | th->msize, | 729 | th->msize, |
718 | &sm[1]); | 730 | &sm[1]); |
@@ -737,8 +749,6 @@ handle_send_ready (void *cls, | |||
737 | GNUNET_STRINGS_relative_time_to_string (delay, | 749 | GNUNET_STRINGS_relative_time_to_string (delay, |
738 | GNUNET_YES), | 750 | GNUNET_YES), |
739 | (th->cork) ? " (corked)" : ""); | 751 | (th->cork) ? " (corked)" : ""); |
740 | GNUNET_MQ_send (h->mq, | ||
741 | env); | ||
742 | } | 752 | } |
743 | 753 | ||
744 | 754 | ||
@@ -838,13 +848,13 @@ reconnect (struct GNUNET_CORE_Handle *h) | |||
838 | * @param inbound_notify function to call for all inbound messages, can be NULL | 848 | * @param inbound_notify function to call for all inbound messages, can be NULL |
839 | * @param inbound_hdr_only set to #GNUNET_YES if inbound_notify will only read the | 849 | * @param inbound_hdr_only set to #GNUNET_YES if inbound_notify will only read the |
840 | * GNUNET_MessageHeader and hence we do not need to give it the full message; | 850 | * GNUNET_MessageHeader and hence we do not need to give it the full message; |
841 | * can be used to improve efficiency, ignored if @a inbound_notify is NULLL | 851 | * can be used to improve efficiency, ignored if @a inbound_notify is NULL |
842 | * @param outbound_notify function to call for all outbound messages, can be NULL | 852 | * @param outbound_notify function to call for all outbound messages, can be NULL |
843 | * @param outbound_hdr_only set to #GNUNET_YES if outbound_notify will only read the | 853 | * @param outbound_hdr_only set to #GNUNET_YES if outbound_notify will only read the |
844 | * GNUNET_MessageHeader and hence we do not need to give it the full message | 854 | * GNUNET_MessageHeader and hence we do not need to give it the full message |
845 | * can be used to improve efficiency, ignored if @a outbound_notify is NULLL | 855 | * can be used to improve efficiency, ignored if @a outbound_notify is NULL |
846 | * @param handlers callbacks for messages we care about, NULL-terminated | 856 | * @param handlers callbacks for messages we care about, NULL-terminated |
847 | * @return handle to the core service (only useful for disconnect until 'init' is called); | 857 | * @return handle to the core service (only useful for disconnect until @a init is called); |
848 | * NULL on error (in this case, init is never called) | 858 | * NULL on error (in this case, init is never called) |
849 | */ | 859 | */ |
850 | struct GNUNET_CORE_Handle * | 860 | struct GNUNET_CORE_Handle * |