diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-09 07:10:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-09 07:10:37 +0100 |
commit | daf0c12b555bc2baf59b97a7279a8f3f5db16511 (patch) | |
tree | 258fdfe960affac59f3cdecf807d6679df20dfc2 /src/cadet | |
parent | 73b0f06dd9112163e4a1f89f3218ff0ecddbcd76 (diff) | |
download | gnunet-daf0c12b555bc2baf59b97a7279a8f3f5db16511.tar.gz gnunet-daf0c12b555bc2baf59b97a7279a8f3f5db16511.zip |
fix crashes caused by DLL removes preceeding DLL inserts
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 9 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 1c500f716..fa2bb962b 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -685,7 +685,7 @@ conn_message_sent (void *cls, | |||
685 | LOG (GNUNET_ERROR_TYPE_INFO, | 685 | LOG (GNUNET_ERROR_TYPE_INFO, |
686 | ">>> %s (%s %4u) on conn %s (%p) %s [%5u] in queue %s\n", | 686 | ">>> %s (%s %4u) on conn %s (%p) %s [%5u] in queue %s\n", |
687 | GC_m2s (type), GC_m2s (payload_type), pid, GCC_2s (c), c, | 687 | GC_m2s (type), GC_m2s (payload_type), pid, GCC_2s (c), c, |
688 | GC_f2s(fwd), size, | 688 | GC_f2s (fwd), size, |
689 | GNUNET_STRINGS_relative_time_to_string (wait, GNUNET_YES)); | 689 | GNUNET_STRINGS_relative_time_to_string (wait, GNUNET_YES)); |
690 | 690 | ||
691 | /* If c is NULL, nothing to update. */ | 691 | /* If c is NULL, nothing to update. */ |
@@ -3264,7 +3264,10 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3264 | c->pending_messages++; | 3264 | c->pending_messages++; |
3265 | 3265 | ||
3266 | q = GNUNET_new (struct CadetConnectionQueue); | 3266 | q = GNUNET_new (struct CadetConnectionQueue); |
3267 | q->cont = cont; | ||
3268 | q->cont_cls = cont_cls; | ||
3267 | q->forced = force; | 3269 | q->forced = force; |
3270 | GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q); | ||
3268 | q->peer_q = GCP_send (get_hop (c, fwd), message, | 3271 | q->peer_q = GCP_send (get_hop (c, fwd), message, |
3269 | payload_type, payload_id, | 3272 | payload_type, payload_id, |
3270 | c, fwd, | 3273 | c, fwd, |
@@ -3272,13 +3275,11 @@ GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
3272 | if (NULL == q->peer_q) | 3275 | if (NULL == q->peer_q) |
3273 | { | 3276 | { |
3274 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c)); | 3277 | LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c)); |
3278 | GNUNET_CONTAINER_DLL_remove (fc->q_head, fc->q_tail, q); | ||
3275 | GNUNET_free (q); | 3279 | GNUNET_free (q); |
3276 | GCC_check_connections (); | 3280 | GCC_check_connections (); |
3277 | return NULL; | 3281 | return NULL; |
3278 | } | 3282 | } |
3279 | q->cont = cont; | ||
3280 | q->cont_cls = cont_cls; | ||
3281 | GNUNET_CONTAINER_DLL_insert (fc->q_head, fc->q_tail, q); | ||
3282 | GCC_check_connections (); | 3283 | GCC_check_connections (); |
3283 | return q; | 3284 | return q; |
3284 | } | 3285 | } |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index c312d56bf..9835e5d5e 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1106,6 +1106,7 @@ call_peer_cont (struct CadetPeerQueue *q, int sent) | |||
1106 | q->c, q->c_fwd, sent, | 1106 | q->c, q->c_fwd, sent, |
1107 | q->type, q->payload_type, q->payload_id, | 1107 | q->type, q->payload_type, q->payload_id, |
1108 | q->size, wait_time); | 1108 | q->size, wait_time); |
1109 | q->cont = NULL; | ||
1109 | } | 1110 | } |
1110 | GNUNET_CONTAINER_DLL_remove (q->peer->q_head, q->peer->q_tail, q); | 1111 | GNUNET_CONTAINER_DLL_remove (q->peer->q_head, q->peer->q_tail, q); |
1111 | } | 1112 | } |
@@ -1191,7 +1192,8 @@ GCP_send (struct CadetPeer *peer, | |||
1191 | q->payload_id = payload_id; | 1192 | q->payload_id = payload_id; |
1192 | q->c = c; | 1193 | q->c = c; |
1193 | q->c_fwd = fwd; | 1194 | q->c_fwd = fwd; |
1194 | GNUNET_MQ_notify_sent (q->env, mq_sent, q); | 1195 | GNUNET_MQ_notify_sent (q->env, &mq_sent, q); |
1196 | GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q); | ||
1195 | 1197 | ||
1196 | if (GNUNET_YES == q->management_traffic) | 1198 | if (GNUNET_YES == q->management_traffic) |
1197 | { | 1199 | { |
@@ -1206,6 +1208,7 @@ GCP_send (struct CadetPeer *peer, | |||
1206 | q->payload_id, GCC_2s (c), GC_f2s (q->c_fwd)); | 1208 | q->payload_id, GCC_2s (c), GC_f2s (q->c_fwd)); |
1207 | GNUNET_MQ_discard (q->env); | 1209 | GNUNET_MQ_discard (q->env); |
1208 | call_peer_cont (q, GNUNET_YES); | 1210 | call_peer_cont (q, GNUNET_YES); |
1211 | GNUNET_CONTAINER_DLL_remove (peer->q_head, peer->q_tail, q); | ||
1209 | GNUNET_free (q); | 1212 | GNUNET_free (q); |
1210 | return NULL; | 1213 | return NULL; |
1211 | } | 1214 | } |
@@ -1213,7 +1216,6 @@ GCP_send (struct CadetPeer *peer, | |||
1213 | peer->queue_n++; | 1216 | peer->queue_n++; |
1214 | } | 1217 | } |
1215 | 1218 | ||
1216 | GNUNET_CONTAINER_DLL_insert (peer->q_head, peer->q_tail, q); | ||
1217 | GCC_check_connections (); | 1219 | GCC_check_connections (); |
1218 | return q; | 1220 | return q; |
1219 | } | 1221 | } |