aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/cadet_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-21 18:10:38 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-21 18:10:38 +0200
commit61bf943d09cd43ca5fe9de1a8d329b808b0b194d (patch)
tree7676c015238a5b2d46b56af58bde4643913c3dd0 /src/cadet/cadet_api.c
parent882a4ce1bb696d00abaa841ac88737765588cee9 (diff)
downloadgnunet-61bf943d09cd43ca5fe9de1a8d329b808b0b194d.tar.gz
gnunet-61bf943d09cd43ca5fe9de1a8d329b808b0b194d.zip
fix crash on unexpected client disconnect on incoming message, remove bogus assertion
Diffstat (limited to 'src/cadet/cadet_api.c')
-rw-r--r--src/cadet/cadet_api.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 3c142a95c..59f0bfe85 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -464,6 +464,10 @@ cadet_mq_send_now (void *cls)
464 } 464 }
465 ch->allow_send--; 465 ch->allow_send--;
466 ch->pending_env = NULL; 466 ch->pending_env = NULL;
467 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
468 "Sending message on channel %s to CADET, new window size is %u\n",
469 GNUNET_i2s (&ch->peer),
470 ch->allow_send);
467 GNUNET_MQ_send (ch->cadet->mq, 471 GNUNET_MQ_send (ch->cadet->mq,
468 env); 472 env);
469 GNUNET_MQ_impl_send_continue (ch->mq); 473 GNUNET_MQ_impl_send_continue (ch->mq);
@@ -781,6 +785,11 @@ handle_local_ack (void *cls,
781 return; 785 return;
782 } 786 }
783 ch->allow_send++; 787 ch->allow_send++;
788 LOG (GNUNET_ERROR_TYPE_DEBUG,
789 "Got an ACK on mq channel %X (peer %s); new window size is %u!\n",
790 ntohl (ch->ccn.channel_of_client),
791 GNUNET_i2s (&ch->peer),
792 ch->allow_send);
784 if (NULL == ch->pending_env) 793 if (NULL == ch->pending_env)
785 { 794 {
786 LOG (GNUNET_ERROR_TYPE_DEBUG, 795 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -792,9 +801,6 @@ handle_local_ack (void *cls,
792 } 801 }
793 if (NULL != ch->mq_cont) 802 if (NULL != ch->mq_cont)
794 return; /* already working on it! */ 803 return; /* already working on it! */
795 LOG (GNUNET_ERROR_TYPE_DEBUG,
796 "Got an ACK on mq channel %X, sending pending message!\n",
797 ntohl (ch->ccn.channel_of_client));
798 ch->mq_cont 804 ch->mq_cont
799 = GNUNET_SCHEDULER_add_now (&cadet_mq_send_now, 805 = GNUNET_SCHEDULER_add_now (&cadet_mq_send_now,
800 ch); 806 ch);
@@ -992,6 +998,7 @@ check_get_tunnels (void *cls,
992{ 998{
993 size_t esize; 999 size_t esize;
994 1000
1001 (void) cls;
995 esize = ntohs (message->size); 1002 esize = ntohs (message->size);
996 if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == esize) 1003 if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == esize)
997 return GNUNET_OK; 1004 return GNUNET_OK;
@@ -1051,6 +1058,7 @@ check_get_tunnel (void *cls,
1051 size_t esize; 1058 size_t esize;
1052 size_t msize; 1059 size_t msize;
1053 1060
1061 (void) cls;
1054 /* Verify message sanity */ 1062 /* Verify message sanity */
1055 msize = ntohs (msg->header.size); 1063 msize = ntohs (msg->header.size);
1056 esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel); 1064 esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
@@ -1096,7 +1104,6 @@ handle_get_tunnel (void *cls,
1096 1104
1097 if (NULL == h->info_cb.tunnel_cb) 1105 if (NULL == h->info_cb.tunnel_cb)
1098 return; 1106 return;
1099
1100 ch_n = ntohl (msg->channels); 1107 ch_n = ntohl (msg->channels);
1101 c_n = ntohl (msg->connections); 1108 c_n = ntohl (msg->connections);
1102 1109
@@ -1191,13 +1198,8 @@ destroy_channel_cb (void *cls,
1191 /* struct GNUNET_CADET_Handle *handle = cls; */ 1198 /* struct GNUNET_CADET_Handle *handle = cls; */
1192 struct GNUNET_CADET_Channel *ch = value; 1199 struct GNUNET_CADET_Channel *ch = value;
1193 1200
1194 if (ntohl (ch->ccn.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI) 1201 (void) cls;
1195 { 1202 (void) cid;
1196 GNUNET_break (0);
1197 LOG (GNUNET_ERROR_TYPE_DEBUG,
1198 "channel %X not destroyed\n",
1199 ntohl (ch->ccn.channel_of_client));
1200 }
1201 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1203 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1202 "Destroying channel due to GNUNET_CADET_disconnect()\n"); 1204 "Destroying channel due to GNUNET_CADET_disconnect()\n");
1203 destroy_channel (ch); 1205 destroy_channel (ch);
@@ -1222,6 +1224,7 @@ destroy_port_cb (void *cls,
1222 /* struct GNUNET_CADET_Handle *handle = cls; */ 1224 /* struct GNUNET_CADET_Handle *handle = cls; */
1223 struct GNUNET_CADET_Port *port = value; 1225 struct GNUNET_CADET_Port *port = value;
1224 1226
1227 (void) cls;
1225 /* This is a warning, the app should have cleanly closed all open ports */ 1228 /* This is a warning, the app should have cleanly closed all open ports */
1226 GNUNET_break (0); 1229 GNUNET_break (0);
1227 GNUNET_CADET_close_port (port); 1230 GNUNET_CADET_close_port (port);