diff options
author | t3sserakt <t3ss@posteo.de> | 2018-06-28 01:36:18 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2018-06-28 01:36:23 +0200 |
commit | f4279d5bfd1e10fa668a262226cb159910f08680 (patch) | |
tree | de9f0699a82498091a7a8189766edf4d7e6d8d8e /src/cadet | |
parent | b294b0e78e44543024f19f197cbac39f86091b88 (diff) | |
parent | 7540ebcd02d9bfe0a690689a1f57952eda5b5c81 (diff) | |
download | gnunet-f4279d5bfd1e10fa668a262226cb159910f08680.tar.gz gnunet-f4279d5bfd1e10fa668a262226cb159910f08680.zip |
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-cadet.c | 25 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet.c | 12 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 2 |
3 files changed, 29 insertions, 10 deletions
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index 67cebf02b..b22881907 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_cadet_service.h" | 27 | #include "gnunet_cadet_service.h" |
28 | #include "cadet.h" | 28 | #include "cadet.h" |
29 | 29 | ||
30 | #define STREAM_BUFFER_SIZE 1024 // Pakets | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * Option -P. | 33 | * Option -P. |
@@ -123,6 +124,8 @@ static struct GNUNET_SCHEDULER_Task *rd_task; | |||
123 | */ | 124 | */ |
124 | static struct GNUNET_SCHEDULER_Task *job; | 125 | static struct GNUNET_SCHEDULER_Task *job; |
125 | 126 | ||
127 | static unsigned int sent_pkt; | ||
128 | |||
126 | 129 | ||
127 | /** | 130 | /** |
128 | * Wait for input on STDIO and send it out over the #ch. | 131 | * Wait for input on STDIO and send it out over the #ch. |
@@ -228,6 +231,12 @@ shutdown_task (void *cls) | |||
228 | } | 231 | } |
229 | } | 232 | } |
230 | 233 | ||
234 | void * | ||
235 | mq_cb(void *cls) | ||
236 | { | ||
237 | listen_stdio (); | ||
238 | } | ||
239 | |||
231 | 240 | ||
232 | /** | 241 | /** |
233 | * Task run in stdio mode, after some data is available at stdin. | 242 | * Task run in stdio mode, after some data is available at stdin. |
@@ -248,6 +257,8 @@ read_stdio (void *cls) | |||
248 | 60000); | 257 | 60000); |
249 | if (data_size < 1) | 258 | if (data_size < 1) |
250 | { | 259 | { |
260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
261 | "read() returned %s\n", strerror(errno)); | ||
251 | GNUNET_SCHEDULER_shutdown(); | 262 | GNUNET_SCHEDULER_shutdown(); |
252 | return; | 263 | return; |
253 | } | 264 | } |
@@ -262,9 +273,21 @@ read_stdio (void *cls) | |||
262 | data_size); | 273 | data_size); |
263 | GNUNET_MQ_send (GNUNET_CADET_get_mq (ch), | 274 | GNUNET_MQ_send (GNUNET_CADET_get_mq (ch), |
264 | env); | 275 | env); |
276 | |||
277 | sent_pkt++; | ||
278 | |||
265 | if (GNUNET_NO == echo) | 279 | if (GNUNET_NO == echo) |
266 | { | 280 | { |
267 | listen_stdio (); | 281 | // Use MQ's notification if too much data of stdin is pooring in too fast. |
282 | if (STREAM_BUFFER_SIZE < sent_pkt) | ||
283 | { | ||
284 | GNUNET_MQ_notify_sent (env, mq_cb, cls); | ||
285 | sent_pkt = 0; | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | listen_stdio (); | ||
290 | } | ||
268 | } | 291 | } |
269 | else | 292 | else |
270 | { | 293 | { |
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index 8ccf4ae07..712c6339a 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -927,29 +927,23 @@ get_peer_info (void *cls, | |||
927 | struct CadetClient *c = cls; | 927 | struct CadetClient *c = cls; |
928 | struct GNUNET_MQ_Envelope *env; | 928 | struct GNUNET_MQ_Envelope *env; |
929 | struct GNUNET_CADET_LocalInfoPeer *msg; | 929 | struct GNUNET_CADET_LocalInfoPeer *msg; |
930 | |||
931 | 930 | ||
932 | env = GNUNET_MQ_msg (msg, | 931 | env = GNUNET_MQ_msg (msg, |
933 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | 932 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); |
934 | |||
935 | msg->offset = htons(0); | 933 | msg->offset = htons(0); |
936 | msg->destination = *peer; | 934 | msg->destination = *peer; |
937 | msg->paths = htons (GCP_count_paths (p)); | 935 | msg->paths = htons (GCP_count_paths (p)); |
938 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, | 936 | msg->tunnel = htons (NULL != GCP_get_tunnel (p, |
939 | GNUNET_NO)); | 937 | GNUNET_NO)); |
940 | msg->finished_with_paths = htons(0); | 938 | msg->finished_with_paths = htons(0); |
941 | |||
942 | GNUNET_MQ_send (c->mq, | 939 | GNUNET_MQ_send (c->mq, |
943 | env); | 940 | env); |
944 | 941 | GCP_iterate_indirect_paths (p, | |
945 | GCP_iterate_indirect_paths(p, | 942 | &path_info_iterator, |
946 | &path_info_iterator, | 943 | c->mq); |
947 | c->mq); | ||
948 | |||
949 | } | 944 | } |
950 | 945 | ||
951 | 946 | ||
952 | |||
953 | /** | 947 | /** |
954 | * Handler for client's SHOW_PEER request. | 948 | * Handler for client's SHOW_PEER request. |
955 | * | 949 | * |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 09dfcd4d7..b375d51ca 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1217,6 +1217,8 @@ GCP_iterate_paths (struct CadetPeer *cp, | |||
1217 | (NULL == cp->core_mq) ? "" : " including direct link"); | 1217 | (NULL == cp->core_mq) ? "" : " including direct link"); |
1218 | if (NULL != cp->core_mq) | 1218 | if (NULL != cp->core_mq) |
1219 | { | 1219 | { |
1220 | /* FIXME: this branch seems to duplicate the | ||
1221 | i=0 case below (direct link). Leave out!??? -CG */ | ||
1220 | struct CadetPeerPath *path; | 1222 | struct CadetPeerPath *path; |
1221 | 1223 | ||
1222 | path = GCPP_get_path_from_route (1, | 1224 | path = GCPP_get_path_from_route (1, |