diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-11-07 16:33:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-11-07 16:33:42 +0000 |
commit | 0c89b2a16eae49cb23635f6d6c0f13da070c5c66 (patch) | |
tree | 559186ca56ac1279a611d31f3bf3816bc971431c /src/transport/plugin_transport_udp.c | |
parent | 2e33b6fcbad3c1b8ebf7176c39a201c39b23c2b2 (diff) | |
download | gnunet-0c89b2a16eae49cb23635f6d6c0f13da070c5c66.tar.gz gnunet-0c89b2a16eae49cb23635f6d6c0f13da070c5c66.zip |
implementing plugin session monitoring API (#3452)
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index bb223263f..37de3c06e 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1270,7 +1270,7 @@ fragmented_message_done (struct UDP_FragmentationContext *fc, | |||
1270 | } | 1270 | } |
1271 | notify_session_monitor (s->plugin, | 1271 | notify_session_monitor (s->plugin, |
1272 | s, | 1272 | s, |
1273 | GNUNET_TRANSPORT_SS_UP); | 1273 | GNUNET_TRANSPORT_SS_UPDATE); |
1274 | /* Destroy fragmentation context */ | 1274 | /* Destroy fragmentation context */ |
1275 | GNUNET_FRAGMENT_context_destroy (fc->frag, | 1275 | GNUNET_FRAGMENT_context_destroy (fc->frag, |
1276 | &s->last_expected_msg_delay, | 1276 | &s->last_expected_msg_delay, |
@@ -1385,7 +1385,7 @@ udp_disconnect_session (void *cls, | |||
1385 | } | 1385 | } |
1386 | notify_session_monitor (s->plugin, | 1386 | notify_session_monitor (s->plugin, |
1387 | s, | 1387 | s, |
1388 | GNUNET_TRANSPORT_SS_DOWN); | 1388 | GNUNET_TRANSPORT_SS_DONE); |
1389 | plugin->env->session_end (plugin->env->cls, | 1389 | plugin->env->session_end (plugin->env->cls, |
1390 | s->address, | 1390 | s->address, |
1391 | s); | 1391 | s); |
@@ -1508,7 +1508,7 @@ session_timeout (void *cls, | |||
1508 | the monitor, it may think we're about to die ... */ | 1508 | the monitor, it may think we're about to die ... */ |
1509 | notify_session_monitor (s->plugin, | 1509 | notify_session_monitor (s->plugin, |
1510 | s, | 1510 | s, |
1511 | GNUNET_TRANSPORT_SS_UP); | 1511 | GNUNET_TRANSPORT_SS_UPDATE); |
1512 | s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, | 1512 | s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, |
1513 | &session_timeout, | 1513 | &session_timeout, |
1514 | s); | 1514 | s); |
@@ -2154,7 +2154,7 @@ udp_plugin_send (void *cls, | |||
2154 | } | 2154 | } |
2155 | notify_session_monitor (s->plugin, | 2155 | notify_session_monitor (s->plugin, |
2156 | s, | 2156 | s, |
2157 | GNUNET_TRANSPORT_SS_UP); | 2157 | GNUNET_TRANSPORT_SS_UPDATE); |
2158 | schedule_select (plugin); | 2158 | schedule_select (plugin); |
2159 | return udpmlen; | 2159 | return udpmlen; |
2160 | } | 2160 | } |
@@ -2335,8 +2335,14 @@ process_udp_message (struct Plugin *plugin, | |||
2335 | { | 2335 | { |
2336 | s = udp_plugin_create_session (plugin, address); | 2336 | s = udp_plugin_create_session (plugin, address); |
2337 | plugin->env->session_start (NULL, address, s, NULL, 0); | 2337 | plugin->env->session_start (NULL, address, s, NULL, 0); |
2338 | notify_session_monitor (s->plugin, | ||
2339 | s, | ||
2340 | GNUNET_TRANSPORT_SS_INIT); | ||
2341 | notify_session_monitor (s->plugin, | ||
2342 | s, | ||
2343 | GNUNET_TRANSPORT_SS_UP); | ||
2338 | } | 2344 | } |
2339 | GNUNET_free(address); | 2345 | GNUNET_free (address); |
2340 | 2346 | ||
2341 | /* iterate over all embedded messages */ | 2347 | /* iterate over all embedded messages */ |
2342 | si.session = s; | 2348 | si.session = s; |
@@ -2446,7 +2452,7 @@ ack_proc (void *cls, | |||
2446 | enqueue (rc->plugin, udpw); | 2452 | enqueue (rc->plugin, udpw); |
2447 | notify_session_monitor (s->plugin, | 2453 | notify_session_monitor (s->plugin, |
2448 | s, | 2454 | s, |
2449 | GNUNET_TRANSPORT_SS_UP); | 2455 | GNUNET_TRANSPORT_SS_UPDATE); |
2450 | schedule_select (rc->plugin); | 2456 | schedule_select (rc->plugin); |
2451 | } | 2457 | } |
2452 | 2458 | ||
@@ -2845,7 +2851,7 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head, | |||
2845 | if (GNUNET_YES == removed) | 2851 | if (GNUNET_YES == removed) |
2846 | notify_session_monitor (session->plugin, | 2852 | notify_session_monitor (session->plugin, |
2847 | session, | 2853 | session, |
2848 | GNUNET_TRANSPORT_SS_UP); | 2854 | GNUNET_TRANSPORT_SS_UPDATE); |
2849 | return udpw; | 2855 | return udpw; |
2850 | } | 2856 | } |
2851 | 2857 | ||
@@ -2955,7 +2961,7 @@ udp_select_send (struct Plugin *plugin, | |||
2955 | dequeue (plugin, udpw); | 2961 | dequeue (plugin, udpw); |
2956 | notify_session_monitor (plugin, | 2962 | notify_session_monitor (plugin, |
2957 | udpw->session, | 2963 | udpw->session, |
2958 | GNUNET_TRANSPORT_SS_UP); | 2964 | GNUNET_TRANSPORT_SS_UPDATE); |
2959 | GNUNET_free (udpw); | 2965 | GNUNET_free (udpw); |
2960 | return GNUNET_SYSERR; | 2966 | return GNUNET_SYSERR; |
2961 | } | 2967 | } |
@@ -2994,7 +3000,7 @@ udp_select_send (struct Plugin *plugin, | |||
2994 | dequeue (plugin, udpw); | 3000 | dequeue (plugin, udpw); |
2995 | notify_session_monitor (plugin, | 3001 | notify_session_monitor (plugin, |
2996 | udpw->session, | 3002 | udpw->session, |
2997 | GNUNET_TRANSPORT_SS_UP); | 3003 | GNUNET_TRANSPORT_SS_UPDATE); |
2998 | GNUNET_free(udpw); | 3004 | GNUNET_free(udpw); |
2999 | return sent; | 3005 | return sent; |
3000 | } | 3006 | } |
@@ -3311,6 +3317,9 @@ send_session_info_iter (void *cls, | |||
3311 | 3317 | ||
3312 | notify_session_monitor (plugin, | 3318 | notify_session_monitor (plugin, |
3313 | session, | 3319 | session, |
3320 | GNUNET_TRANSPORT_SS_INIT); | ||
3321 | notify_session_monitor (plugin, | ||
3322 | session, | ||
3314 | GNUNET_TRANSPORT_SS_UP); | 3323 | GNUNET_TRANSPORT_SS_UP); |
3315 | return GNUNET_OK; | 3324 | return GNUNET_OK; |
3316 | } | 3325 | } |