- fix segfault
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_connection.c
index 8a83adc51a44afed7a3eed60d4f7a43f75a739fe..e966e7192f50417bc92583c84c84e3246c198bb8 100644 (file)
@@ -1825,7 +1825,8 @@ GMC_destroy (struct MeshConnection *c)
 
   /* Delete */
   GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO);
-  GMT_remove_connection (c->t, c);
+  if (NULL != c->t)
+    GMT_remove_connection (c->t, c);
   GNUNET_free (c);
 }
 
@@ -2195,7 +2196,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
 void
 GMC_send_create (struct MeshConnection *connection)
 {
-enum MeshTunnel3State state;
+  enum MeshTunnel3State state;
   size_t size;
 
   size = sizeof (struct GNUNET_MESH_ConnectionCreate);
@@ -2210,6 +2211,7 @@ enum MeshTunnel3State state;
     GMT_change_state (connection->t, MESH_TUNNEL3_WAITING);
   if (MESH_CONNECTION_NEW == connection->state)
     connection_change_state (connection, MESH_CONNECTION_SENT);
+  connection->fwd_fc.queue_n++;
 }