aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-25 15:05:27 +0000
committerChristian Grothoff <christian@grothoff.org>2015-05-25 15:05:27 +0000
commit33a7282c26b14f838ad6f1016b90b710cec5f93f (patch)
treefd822df4e5ce469278f358d8d2220181d54a79c4 /src/exit
parentb0eee0f554ecc36df76338021da57e3831ee74ad (diff)
downloadgnunet-33a7282c26b14f838ad6f1016b90b710cec5f93f.tar.gz
gnunet-33a7282c26b14f838ad6f1016b90b710cec5f93f.zip
notify cadet when we are done - for flow control and to get next packet
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 9479ef1ad..1afa29200 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -563,7 +563,8 @@ process_dns_result (void *cls,
563 * #GNUNET_SYSERR to close it (signal serious error) 563 * #GNUNET_SYSERR to close it (signal serious error)
564 */ 564 */
565static int 565static int
566receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *channel, 566receive_dns_request (void *cls GNUNET_UNUSED,
567 struct GNUNET_CADET_Channel *channel,
567 void **channel_ctx, 568 void **channel_ctx,
568 const struct GNUNET_MessageHeader *message) 569 const struct GNUNET_MessageHeader *message)
569{ 570{
@@ -575,7 +576,10 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *chann
575 struct GNUNET_TUN_DnsHeader *dout; 576 struct GNUNET_TUN_DnsHeader *dout;
576 577
577 if (NULL == dnsstub) 578 if (NULL == dnsstub)
579 {
580 GNUNET_break_op (0);
578 return GNUNET_SYSERR; 581 return GNUNET_SYSERR;
582 }
579 if (GNUNET_NO == ts->is_dns) 583 if (GNUNET_NO == ts->is_dns)
580 { 584 {
581 GNUNET_break_op (0); 585 GNUNET_break_op (0);
@@ -607,6 +611,7 @@ receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *chann
607 NULL); 611 NULL);
608 if (NULL == ts->specifics.dns.rs) 612 if (NULL == ts->specifics.dns.rs)
609 return GNUNET_SYSERR; 613 return GNUNET_SYSERR;
614 GNUNET_CADET_receive_done (channel);
610 return GNUNET_OK; 615 return GNUNET_OK;
611} 616}
612 617
@@ -864,7 +869,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
864 */ 869 */
865static void 870static void
866send_packet_to_cadet_channel (struct ChannelState *s, 871send_packet_to_cadet_channel (struct ChannelState *s,
867 struct ChannelMessageQueue *tnq) 872 struct ChannelMessageQueue *tnq)
868{ 873{
869 struct GNUNET_CADET_Channel *cadet_channel; 874 struct GNUNET_CADET_Channel *cadet_channel;
870 875
@@ -873,11 +878,11 @@ send_packet_to_cadet_channel (struct ChannelState *s,
873 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq); 878 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq);
874 if (NULL == s->th) 879 if (NULL == s->th)
875 s->th = GNUNET_CADET_notify_transmit_ready (cadet_channel, 880 s->th = GNUNET_CADET_notify_transmit_ready (cadet_channel,
876 GNUNET_NO /* cork */, 881 GNUNET_NO /* cork */,
877 GNUNET_TIME_UNIT_FOREVER_REL, 882 GNUNET_TIME_UNIT_FOREVER_REL,
878 tnq->len, 883 tnq->len,
879 &send_to_peer_notify_callback, 884 &send_to_peer_notify_callback,
880 s); 885 s);
881} 886}
882 887
883 888
@@ -1242,7 +1247,8 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1242 * @param message message received from helper 1247 * @param message message received from helper
1243 */ 1248 */
1244static int 1249static int
1245message_token (void *cls GNUNET_UNUSED, void *client GNUNET_UNUSED, 1250message_token (void *cls GNUNET_UNUSED,
1251 void *client GNUNET_UNUSED,
1246 const struct GNUNET_MessageHeader *message) 1252 const struct GNUNET_MessageHeader *message)
1247{ 1253{
1248 const struct GNUNET_TUN_Layer2PacketHeader *pkt_tun; 1254 const struct GNUNET_TUN_Layer2PacketHeader *pkt_tun;
@@ -1921,6 +1927,7 @@ receive_tcp_service (void *cls,
1921 &state->specifics.tcp_udp.ri.local_address, 1927 &state->specifics.tcp_udp.ri.local_address,
1922 &start->tcp_header, 1928 &start->tcp_header,
1923 &start[1], pkt_len); 1929 &start[1], pkt_len);
1930 GNUNET_CADET_receive_done (channel);
1924 return GNUNET_YES; 1931 return GNUNET_YES;
1925} 1932}
1926 1933
@@ -2045,6 +2052,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED,
2045 &state->specifics.tcp_udp.ri.local_address, 2052 &state->specifics.tcp_udp.ri.local_address,
2046 &start->tcp_header, 2053 &start->tcp_header,
2047 payload, pkt_len); 2054 payload, pkt_len);
2055 GNUNET_CADET_receive_done (channel);
2048 return GNUNET_YES; 2056 return GNUNET_YES;
2049} 2057}
2050 2058
@@ -2055,7 +2063,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED,
2055 * 2063 *
2056 * @param cls closure, NULL 2064 * @param cls closure, NULL
2057 * @param channel connection to the other end 2065 * @param channel connection to the other end
2058 * @param channel_ctx pointer to our 'struct ChannelState *' 2066 * @param channel_ctx pointer to our `struct ChannelState *`
2059 * @param message the actual message 2067 * @param message the actual message
2060 * @return #GNUNET_OK to keep the connection open, 2068 * @return #GNUNET_OK to keep the connection open,
2061 * #GNUNET_SYSERR to close it (signal serious error) 2069 * #GNUNET_SYSERR to close it (signal serious error)
@@ -2126,6 +2134,7 @@ receive_tcp_data (void *cls GNUNET_UNUSED,
2126 &state->specifics.tcp_udp.ri.local_address, 2134 &state->specifics.tcp_udp.ri.local_address,
2127 &data->tcp_header, 2135 &data->tcp_header,
2128 &data[1], pkt_len); 2136 &data[1], pkt_len);
2137 GNUNET_CADET_receive_done (channel);
2129 return GNUNET_YES; 2138 return GNUNET_YES;
2130} 2139}
2131 2140
@@ -2480,6 +2489,7 @@ receive_icmp_remote (void *cls,
2480 &state->specifics.tcp_udp.ri.local_address, 2489 &state->specifics.tcp_udp.ri.local_address,
2481 &msg->icmp_header, 2490 &msg->icmp_header,
2482 payload, pkt_len); 2491 payload, pkt_len);
2492 GNUNET_CADET_receive_done (channel);
2483 return GNUNET_YES; 2493 return GNUNET_YES;
2484} 2494}
2485 2495
@@ -2727,6 +2737,7 @@ receive_icmp_service (void *cls,
2727 &state->specifics.tcp_udp.ri.local_address, 2737 &state->specifics.tcp_udp.ri.local_address,
2728 &icmp, 2738 &icmp,
2729 payload, pkt_len); 2739 payload, pkt_len);
2740 GNUNET_CADET_receive_done (channel);
2730 return GNUNET_YES; 2741 return GNUNET_YES;
2731} 2742}
2732 2743
@@ -2929,6 +2940,7 @@ receive_udp_remote (void *cls,
2929 send_udp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address, 2940 send_udp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address,
2930 &state->specifics.tcp_udp.ri.local_address, 2941 &state->specifics.tcp_udp.ri.local_address,
2931 payload, pkt_len); 2942 payload, pkt_len);
2943 GNUNET_CADET_receive_done (channel);
2932 return GNUNET_YES; 2944 return GNUNET_YES;
2933} 2945}
2934 2946
@@ -3005,6 +3017,7 @@ receive_udp_service (void *cls,
3005 send_udp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address, 3017 send_udp_packet_via_tun (&state->specifics.tcp_udp.ri.remote_address,
3006 &state->specifics.tcp_udp.ri.local_address, 3018 &state->specifics.tcp_udp.ri.local_address,
3007 &msg[1], pkt_len); 3019 &msg[1], pkt_len);
3020 GNUNET_CADET_receive_done (channel);
3008 return GNUNET_YES; 3021 return GNUNET_YES;
3009} 3022}
3010 3023