Use more-or-equal (some machines are fast enough)
[oweals/gnunet.git] / src / conversation / gnunet-service-conversation.c
index 5d1aaf6e17007f232a73749652002b8f01eea16e..c50c688c21a98de047cc587e0f0584a99061fcf4 100644 (file)
@@ -325,6 +325,7 @@ handle_client_pickup_message (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Channel %u not found\n",
                 msg->cid);
+    GNUNET_SERVER_receive_done (client, GNUNET_YES);
     return;
   }
   switch (ch->status)
@@ -339,7 +340,6 @@ handle_client_pickup_message (void *cls,
   case CS_CALLEE_SHUTDOWN:
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Ignoring client's PICKUP message, line is in SHUTDOWN\n");
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     break;
   case CS_CALLER_CALLING:
   case CS_CALLER_CONNECTED:
@@ -483,6 +483,7 @@ handle_client_hangup_message (void *cls,
     break;
   case CS_CALLEE_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   case CS_CALLER_CALLING:
     ch->status = CS_CALLER_SHUTDOWN;
@@ -492,6 +493,7 @@ handle_client_hangup_message (void *cls,
     break;
   case CS_CALLER_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -541,6 +543,7 @@ handle_client_suspend_message (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Channel %u not found\n",
                 msg->cid);
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   }
   if (GNUNET_YES == ch->suspended_local)
@@ -560,6 +563,7 @@ handle_client_suspend_message (void *cls,
     break;
   case CS_CALLEE_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   case CS_CALLER_CALLING:
     GNUNET_break (0);
@@ -570,6 +574,7 @@ handle_client_suspend_message (void *cls,
     break;
   case CS_CALLER_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -616,6 +621,7 @@ handle_client_resume_message (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Channel %u not found\n",
                 msg->cid);
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   }
   if (GNUNET_YES != ch->suspended_local)
@@ -635,6 +641,7 @@ handle_client_resume_message (void *cls,
     break;
   case CS_CALLEE_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   case CS_CALLER_CALLING:
     GNUNET_break (0);
@@ -645,6 +652,7 @@ handle_client_resume_message (void *cls,
     break;
   case CS_CALLER_SHUTDOWN:
     /* maybe the other peer closed asynchronously... */
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -753,6 +761,7 @@ transmit_line_audio (void *cls,
   mam->header.size = htons (sizeof (struct MeshAudioMessage) + ch->audio_size);
   mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO);
   mam->remote_line = htonl (ch->remote_line);
+  mam->source_line = htonl (ch->line->local_line);
   memcpy (&mam[1], ch->audio_data, ch->audio_size);
   GNUNET_free (ch->audio_data);
   ch->audio_data = NULL;
@@ -798,6 +807,7 @@ handle_client_audio_message (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Channel %u not found\n",
                 msg->cid);
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     return;
   }
 
@@ -1259,7 +1269,8 @@ handle_mesh_audio_message (void *cls,
                (0 == memcmp (&ch->target,
                              &sender,
                              sizeof (struct GNUNET_PeerIdentity))) &&
-               (NULL == ch->channel_unreliable) )
+               (NULL == ch->channel_unreliable) &&
+               (ch->remote_line == ntohl (msg->source_line)) )
             break;
         }
         break;