aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_tunnel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet_tunnel.c')
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 67c2ad5fa..73bd28643 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -1730,15 +1730,15 @@ create_kx_ctx (struct CadetTunnel *t)
1730 * @brief Finish the Key eXchange and destroy the old keys. 1730 * @brief Finish the Key eXchange and destroy the old keys.
1731 * 1731 *
1732 * @param cls Closure (Tunnel for which to finish the KX). 1732 * @param cls Closure (Tunnel for which to finish the KX).
1733 * @param tc Task context.
1734 */ 1733 */
1735static void 1734static void
1736finish_kx (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1735finish_kx (void *cls)
1737{ 1736{
1738 struct CadetTunnel *t = cls; 1737 struct CadetTunnel *t = cls;
1738 const struct GNUNET_SCHEDULER_TaskContext *tc;
1739 1739
1740 LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t)); 1740 LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t));
1741 1741 tc = GNUNET_SCHEDULER_get_task_context ();
1742 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1742 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1743 { 1743 {
1744 LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n"); 1744 LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n");
@@ -2098,15 +2098,15 @@ send_queued_data (struct CadetTunnel *t)
2098 * @brief Resend the AX KX until we complete the handshake. 2098 * @brief Resend the AX KX until we complete the handshake.
2099 * 2099 *
2100 * @param cls Closure (tunnel). 2100 * @param cls Closure (tunnel).
2101 * @param tc Task context.
2102 */ 2101 */
2103static void 2102static void
2104ax_kx_resend (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2103ax_kx_resend (void *cls)
2105{ 2104{
2106 struct CadetTunnel *t = cls; 2105 struct CadetTunnel *t = cls;
2106 const struct GNUNET_SCHEDULER_TaskContext *tc;
2107 2107
2108 t->rekey_task = NULL; 2108 t->rekey_task = NULL;
2109 2109 tc = GNUNET_SCHEDULER_get_task_context ();
2110 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 2110 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
2111 return; 2111 return;
2112 2112
@@ -2328,16 +2328,16 @@ send_pong (struct CadetTunnel *t, uint32_t challenge)
2328 * Initiate a rekey with the remote peer. 2328 * Initiate a rekey with the remote peer.
2329 * 2329 *
2330 * @param cls Closure (tunnel). 2330 * @param cls Closure (tunnel).
2331 * @param tc TaskContext.
2332 */ 2331 */
2333static void 2332static void
2334rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2333rekey_tunnel (void *cls)
2335{ 2334{
2336 struct CadetTunnel *t = cls; 2335 struct CadetTunnel *t = cls;
2336 const struct GNUNET_SCHEDULER_TaskContext *tc;
2337 2337
2338 t->rekey_task = NULL; 2338 t->rekey_task = NULL;
2339
2340 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t)); 2339 LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
2340 tc = GNUNET_SCHEDULER_get_task_context ();
2341 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 2341 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
2342 return; 2342 return;
2343 2343
@@ -2447,16 +2447,16 @@ rekey_iterator (void *cls,
2447 * Create a new ephemeral key and key message, schedule next rekeying. 2447 * Create a new ephemeral key and key message, schedule next rekeying.
2448 * 2448 *
2449 * @param cls Closure (unused). 2449 * @param cls Closure (unused).
2450 * @param tc TaskContext.
2451 */ 2450 */
2452static void 2451static void
2453global_otr_rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2452global_otr_rekey (void *cls)
2454{ 2453{
2455 struct GNUNET_TIME_Absolute time; 2454 struct GNUNET_TIME_Absolute time;
2456 long n; 2455 long n;
2456 const struct GNUNET_SCHEDULER_TaskContext *tc;
2457 2457
2458 rekey_task = NULL; 2458 rekey_task = NULL;
2459 2459 tc = GNUNET_SCHEDULER_get_task_context ();
2460 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 2460 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
2461 return; 2461 return;
2462 2462
@@ -2833,7 +2833,7 @@ handle_ephemeral (struct CadetTunnel *t,
2833 GNUNET_break (0); 2833 GNUNET_break (0);
2834 return; 2834 return;
2835 } 2835 }
2836 rekey_tunnel (t, NULL); 2836 rekey_tunnel (t);
2837 GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO); 2837 GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO);
2838 } 2838 }
2839 2839
@@ -2865,7 +2865,7 @@ handle_ephemeral (struct CadetTunnel *t,
2865 } 2865 }
2866 if (NULL != t->rekey_task) 2866 if (NULL != t->rekey_task)
2867 GNUNET_SCHEDULER_cancel (t->rekey_task); 2867 GNUNET_SCHEDULER_cancel (t->rekey_task);
2868 t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t); 2868 t->rekey_task = GNUNET_SCHEDULER_add_now (&rekey_tunnel, t);
2869 } 2869 }
2870 if (CADET_TUNNEL_KEY_SENT == t->estate) 2870 if (CADET_TUNNEL_KEY_SENT == t->estate)
2871 { 2871 {
@@ -3467,15 +3467,15 @@ GCT_change_estate (struct CadetTunnel* t, enum CadetTunnelEState state)
3467 * of being created/processed. 3467 * of being created/processed.
3468 * 3468 *
3469 * @param cls Closure (Tunnel to check). 3469 * @param cls Closure (Tunnel to check).
3470 * @param tc Task context.
3471 */ 3470 */
3472static void 3471static void
3473trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 3472trim_connections (void *cls)
3474{ 3473{
3475 struct CadetTunnel *t = cls; 3474 struct CadetTunnel *t = cls;
3475 const struct GNUNET_SCHEDULER_TaskContext *tc;
3476 3476
3477 t->trim_connections_task = NULL; 3477 t->trim_connections_task = NULL;
3478 3478 tc = GNUNET_SCHEDULER_get_task_context ();
3479 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 3479 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
3480 return; 3480 return;
3481 3481
@@ -3695,15 +3695,16 @@ GCT_get_channel (struct CadetTunnel *t, CADET_ChannelNumber chid)
3695 * the tunnel. This way we avoid a new public key handshake. 3695 * the tunnel. This way we avoid a new public key handshake.
3696 * 3696 *
3697 * @param cls Closure (tunnel to destroy). 3697 * @param cls Closure (tunnel to destroy).
3698 * @param tc Task context.
3699 */ 3698 */
3700static void 3699static void
3701delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 3700delayed_destroy (void *cls)
3702{ 3701{
3703 struct CadetTunnel *t = cls; 3702 struct CadetTunnel *t = cls;
3704 struct CadetTConnection *iter; 3703 struct CadetTConnection *iter;
3704 const struct GNUNET_SCHEDULER_TaskContext *tc;
3705 3705
3706 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t); 3706 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
3707 tc = GNUNET_SCHEDULER_get_task_context ();
3707 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 3708 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
3708 { 3709 {
3709 LOG (GNUNET_ERROR_TYPE_WARNING, 3710 LOG (GNUNET_ERROR_TYPE_WARNING,