gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23405 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r23405 - gnunet/src/transport
Date: Fri, 24 Aug 2012 15:24:43 +0200

Author: wachs
Date: 2012-08-24 15:24:43 +0200 (Fri, 24 Aug 2012)
New Revision: 23405

Modified:
   gnunet/src/transport/plugin_transport_http_server.c
Log:
more

Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2012-08-24 13:19:05 UTC 
(rev 23404)
+++ gnunet/src/transport/plugin_transport_http_server.c 2012-08-24 13:24:43 UTC 
(rev 23405)
@@ -498,6 +498,9 @@
   }
   GNUNET_assert (NULL != session->server_send);
 
+  if (GNUNET_YES == session->server_send->disconnect)
+    return GNUNET_SYSERR;
+
   /* create new message and schedule */
   bytes_sent = sizeof (struct HTTP_Message) + msgbuf_size;
   msg = GNUNET_malloc (bytes_sent);
@@ -622,6 +625,9 @@
   struct HTTP_Server_Plugin *plugin = s->plugin;
   server_stop_session_timeout(s);
 
+  if (GNUNET_YES == s->session_passed)
+    plugin->env->session_end (plugin->env->cls, &s->target, s);
+
   GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s);
   struct HTTP_Message *msg = s->msg_head;
   struct HTTP_Message *tmp = NULL;
@@ -648,6 +654,9 @@
   GNUNET_free_non_null (s->server_recv);
   GNUNET_free_non_null (s->server_send);
   GNUNET_free (s);
+
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+                   "Session %p destroyed\n", s);
 }
 
 
@@ -827,18 +836,15 @@
 
   if (url_len < 105)
   {
-    GNUNET_break (0);
     goto error; /* too short */
   }
   hash_start = strrchr (url, '/');
   if (NULL == hash_start)
   {
-      GNUNET_break (0);
     goto error; /* '/' delimiter not found */
   }
   if (hash_start >= url_end)
   {
-      GNUNET_break (0);
     goto error; /* mal formed */
   }
   hash_start++;
@@ -848,19 +854,16 @@
     goto error; /* ';' delimiter not found */
   if (hash_end >= url_end)
   {
-      GNUNET_break (0);
     goto error; /* mal formed */
   }
 
   if (hash_start >= hash_end)
   {
-      GNUNET_break (0);
     goto error; /* mal formed */
   }
 
   if ((strlen(hash_start) - strlen(hash_end)) != 103)
   {
-      GNUNET_break (0);
     goto error; /* invalid hash length */
   }
 
@@ -869,13 +872,11 @@
   hash[103] = '\0';
   if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((const char *) hash, 
&(target.hashPubKey)))
   {
-      GNUNET_break (0);
     goto error; /* mal formed */
   }
 
   if (hash_end >= url_end)
   {
-      GNUNET_break (0);
     goto error; /* mal formed */
   }
 
@@ -1343,20 +1344,8 @@
                      "Peer `%s' on address `%s' disconnected\n",
                      GNUNET_i2s (&s->target),
                      http_common_plugin_address_to_string (NULL, s->addr, 
s->addrlen));
-    if (s->msg_tk != NULL)
-    {
-      GNUNET_SERVER_mst_destroy (s->msg_tk);
-      s->msg_tk = NULL;
-    }
 
-    GNUNET_CONTAINER_DLL_remove(plugin->head, plugin->tail, s);
-    server_stop_session_timeout (s);
-    if (GNUNET_YES == s->session_passed)
-      plugin->env->session_end (plugin->env->cls, &s->target, s);
-    GNUNET_free (s->addr);
-    GNUNET_free (s);
-    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Session %p destroyed\n", s);
+    server_delete_session (s);
   }
 }
 
@@ -2458,6 +2447,8 @@
 {
   struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
   struct HTTP_Server_Plugin *plugin = api->cls;
+  struct Session *pos;
+  struct Session *next;
 
   if (GNUNET_SCHEDULER_NO_TASK != plugin->notify_ext_task)
   {
@@ -2483,6 +2474,14 @@
 
   server_stop (plugin);
 
+  next = plugin->head;
+  while (NULL != (pos = next))
+  {
+      next = pos->next;
+      GNUNET_CONTAINER_DLL_remove( plugin->head, plugin->tail, pos);
+      server_delete_session (pos);
+  }
+
   /* Clean up */
   GNUNET_free_non_null (plugin->external_hostname);
   GNUNET_free_non_null (plugin->ext_addr);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]