gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35292 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r35292 - gnunet/src/util
Date: Sat, 21 Feb 2015 21:21:40 +0100

Author: grothoff
Date: 2015-02-21 21:21:40 +0100 (Sat, 21 Feb 2015)
New Revision: 35292

Modified:
   gnunet/src/util/client.c
   gnunet/src/util/connection.c
   gnunet/src/util/network.c
   gnunet/src/util/server.c
Log:
-signal connection failure to receive even if receive is triggered after 
failure is observed

Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c    2015-02-21 12:45:28 UTC (rev 35291)
+++ gnunet/src/util/client.c    2015-02-21 20:21:40 UTC (rev 35292)
@@ -217,7 +217,9 @@
 
   /**
    * Are we currently busy doing receive-processing?
-   * #GNUNET_YES if so, #GNUNET_NO if not.
+   * #GNUNET_YES if so, #GNUNET_NO if not. #GNUNET_SYSERR
+   * if the connection has failed (but we may not have
+   * closed the handle itself yet).
    */
   int in_receive;
 
@@ -504,8 +506,12 @@
  * @param errCode value of errno (on errors receiving)
  */
 static void
-receive_helper (void *cls, const void *buf, size_t available,
-                const struct sockaddr *addr, socklen_t addrlen, int errCode)
+receive_helper (void *cls,
+                const void *buf,
+                size_t available,
+                const struct sockaddr *addr,
+                socklen_t addrlen,
+                int errCode)
 {
   struct GNUNET_CLIENT_Connection *client = cls;
   struct GNUNET_TIME_Relative remaining;
@@ -515,19 +521,25 @@
   GNUNET_assert (GNUNET_NO == client->msg_complete);
   GNUNET_assert (GNUNET_YES == client->in_receive);
   client->in_receive = GNUNET_NO;
-  if ((0 == available) || (NULL == client->connection) || (0 != errCode))
+  if ( (0 == available) ||
+       (NULL == client->connection) ||
+       (0 != errCode) )
   {
     /* signal timeout! */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Timeout in receive_helper, available %u, client->connection %s, 
errCode `%s'\n",
-         (unsigned int) available, NULL == client->connection ? "NULL" : 
"non-NULL",
+         (unsigned int) available,
+         NULL == client->connection ? "NULL" : "non-NULL",
          STRERROR (errCode));
     if (NULL != (receive_handler = client->receiver_handler))
     {
       receive_handler_cls = client->receiver_handler_cls;
       client->receiver_handler = NULL;
-      receive_handler (receive_handler_cls, NULL);
+      receive_handler (receive_handler_cls,
+                       NULL);
     }
+    /* remember failure */
+    client->in_receive = GNUNET_SYSERR;
     return;
   }
   /* FIXME: optimize for common fast case where buf contains the
@@ -565,7 +577,8 @@
  * @param tc scheduler context
  */
 static void
-receive_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+receive_task (void *cls,
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CLIENT_Connection *client = cls;
   GNUNET_CLIENT_MessageHandler handler = client->receiver_handler;
@@ -576,12 +589,22 @@
   char mbuf[msize] GNUNET_ALIGN;
   struct GNUNET_MessageHeader *msg = (struct GNUNET_MessageHeader *) mbuf;
 
+  client->receive_task = NULL;
+  if ( (GNUNET_SYSERR == client->in_receive) &&
+       (GNUNET_YES != client->msg_complete) )
+  {
+    /* Connection failure, signal to caller! */
+    client->receiver_handler = NULL;
+    if (NULL != handler)
+      handler (handler_cls,
+               NULL);
+    return;
+  }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Received message of type %u and size %u from %s service.\n",
        ntohs (cmsg->type),
        msize,
        client->service_name);
-  client->receive_task = NULL;
   GNUNET_assert (GNUNET_YES == client->msg_complete);
   GNUNET_assert (client->received_pos >= msize);
   memcpy (msg, cmsg, msize);
@@ -618,25 +641,29 @@
                client->service_name);
     GNUNET_break (0);           /* this should not happen in well-written 
code! */
     if (NULL != handler)
-      handler (handler_cls, NULL);
+      handler (handler_cls,
+               NULL);
     return;
   }
   client->receiver_handler = handler;
   client->receiver_handler_cls = handler_cls;
   client->receive_timeout = GNUNET_TIME_relative_to_absolute (timeout);
-  if (GNUNET_YES == client->msg_complete)
+  if ( (GNUNET_YES == client->msg_complete) ||
+       (GNUNET_SYSERR == client->in_receive) )
   {
     GNUNET_assert (NULL == client->receive_task);
     client->receive_task = GNUNET_SCHEDULER_add_now (&receive_task, client);
+    return;
   }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "calling GNUNET_CONNECTION_receive\n");
-    GNUNET_assert (GNUNET_NO == client->in_receive);
-    client->in_receive = GNUNET_YES;
-    GNUNET_CONNECTION_receive (client->connection, 
GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
-                               timeout, &receive_helper, client);
-  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "calling GNUNET_CONNECTION_receive\n");
+  GNUNET_assert (GNUNET_NO == client->in_receive);
+  client->in_receive = GNUNET_YES;
+  GNUNET_CONNECTION_receive (client->connection,
+                             GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
+                             timeout,
+                             &receive_helper,
+                             client);
 }
 
 
@@ -751,7 +778,8 @@
  * @param msg message received, NULL on timeout or fatal error
  */
 static void
-confirm_handler (void *cls, const struct GNUNET_MessageHeader *msg)
+confirm_handler (void *cls,
+                 const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_CLIENT_TestHandle *th = cls;
 
@@ -1036,7 +1064,7 @@
  * @param cls our `struct GNUNET_CLIENT_TransmissionHandle`
  * @param size number of bytes available for transmission
  * @param buf where to write them
- * @return number of bytes written to buf
+ * @return number of bytes written to @a buf
  */
 static size_t
 client_notify (void *cls, size_t size, void *buf);
@@ -1111,7 +1139,9 @@
  * @return number of bytes written to @a buf
  */
 static size_t
-client_notify (void *cls, size_t size, void *buf)
+client_notify (void *cls,
+               size_t size,
+               void *buf)
 {
   struct GNUNET_CLIENT_TransmitHandle *th = cls;
   struct GNUNET_CLIENT_Connection *client = th->client;
@@ -1126,14 +1156,16 @@
   {
     delay = GNUNET_TIME_absolute_get_remaining (th->timeout);
     delay.rel_value_us /= 2;
-    if ((GNUNET_YES != th->auto_retry) || (0 == --th->attempts_left) ||
-        (delay.rel_value_us < 1)||
-       (0 != (GNUNET_SCHEDULER_get_reason() & 
GNUNET_SCHEDULER_REASON_SHUTDOWN)))
+    if ( (GNUNET_YES != th->auto_retry) ||
+         (0 == --th->attempts_left) ||
+         (delay.rel_value_us < 1)||
+         (0 != (GNUNET_SCHEDULER_get_reason() & 
GNUNET_SCHEDULER_REASON_SHUTDOWN)))
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "Transmission failed %u times, giving up.\n",
            MAX_ATTEMPTS - th->attempts_left);
-      GNUNET_break (0 == th->notify (th->notify_cls, 0, NULL));
+      GNUNET_break (0 ==
+                    th->notify (th->notify_cls, 0, NULL));
       GNUNET_free (th);
       return 0;
     }
@@ -1232,13 +1264,14 @@
         GNUNET_SCHEDULER_add_delayed (client->back_off,
                                       &client_delayed_retry,
                                       th);
-
   }
   else
   {
-    th->th =
-        GNUNET_CONNECTION_notify_transmit_ready (client->connection, size, 
timeout,
-                                                 &client_notify, th);
+    th->th = GNUNET_CONNECTION_notify_transmit_ready (client->connection,
+                                                      size,
+                                                      timeout,
+                                                      &client_notify,
+                                                      th);
     if (NULL == th->th)
     {
       GNUNET_break (0);
@@ -1281,7 +1314,7 @@
  * NULL and @a size zero if the socket was closed for
  * writing in the meantime.
  *
- * @param cls closure of type "struct TransmitGetResponseContext*"
+ * @param cls closure of type `struct TransmitGetResponseContext *`
  * @param size number of bytes available in @a buf
  * @param buf where the callee should write the message
  * @return number of bytes written to @a buf
@@ -1299,7 +1332,7 @@
   if (NULL == buf)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
-         _("Could not submit request, not expecting to receive a 
response.\n"));
+         "Could not submit request, not expecting to receive a response.\n");
     if (NULL != tc->rn)
       tc->rn (tc->rn_cls, NULL);
     GNUNET_free (tc);
@@ -1307,7 +1340,9 @@
   }
   GNUNET_assert (size >= msize);
   memcpy (buf, tc->hdr, msize);
-  GNUNET_CLIENT_receive (tc->client, tc->rn, tc->rn_cls,
+  GNUNET_CLIENT_receive (tc->client,
+                         tc->rn,
+                         tc->rn_cls,
                          GNUNET_TIME_absolute_get_remaining (tc->timeout));
   GNUNET_free (tc);
   return msize;

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2015-02-21 12:45:28 UTC (rev 35291)
+++ gnunet/src/util/connection.c        2015-02-21 20:21:40 UTC (rev 35292)
@@ -469,7 +469,8 @@
  * @param errcode error code to send
  */
 static void
-signal_receive_error (struct GNUNET_CONNECTION_Handle *connection, int errcode)
+signal_receive_error (struct GNUNET_CONNECTION_Handle *connection,
+                      int errcode)
 {
   GNUNET_CONNECTION_Receiver receiver;
 
@@ -479,7 +480,12 @@
        connection);
   GNUNET_assert (NULL != (receiver = connection->receiver));
   connection->receiver = NULL;
-  receiver (connection->receiver_cls, NULL, 0, connection->addr, 
connection->addrlen, errcode);
+  receiver (connection->receiver_cls,
+            NULL,
+            0,
+            connection->addr,
+            connection->addrlen,
+            errcode);
 }
 
 
@@ -519,8 +525,9 @@
        connection);
   if (NULL != connection->sock)
   {
-    GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR);
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (connection->sock));
+    (void) GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR);
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_NETWORK_socket_close (connection->sock));
     connection->sock = NULL;
     GNUNET_assert (NULL == connection->write_task);
   }
@@ -561,13 +568,15 @@
   /* signal errors for jobs that used to wait on the connection */
   connection->destroy_later = 1;
   if (NULL != connection->receiver)
-    signal_receive_error (connection, ECONNREFUSED);
+    signal_receive_error (connection,
+                          ECONNREFUSED);
   if (NULL != connection->nth.notify_ready)
   {
-    GNUNET_assert (connection->nth.timeout_task != NULL);
+    GNUNET_assert (NULL != connection->nth.timeout_task);
     GNUNET_SCHEDULER_cancel (connection->nth.timeout_task);
     connection->nth.timeout_task = NULL;
-    signal_transmit_error (connection, ECONNREFUSED);
+    signal_transmit_error (connection,
+                           ECONNREFUSED);
   }
   if (-1 == connection->destroy_later)
   {
@@ -979,7 +988,9 @@
     connection->destroy_later = -1;
     return;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connection (%p)\n", connection);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Shutting down connection (%p)\n",
+       connection);
   GNUNET_assert (NULL == connection->nth.notify_ready);
   GNUNET_assert (NULL == connection->receiver);
   if (NULL != connection->write_task)
@@ -1014,15 +1025,21 @@
   if ( (NULL != connection->sock) &&
        (GNUNET_YES != connection->persist) )
   {
-    if ((GNUNET_YES != GNUNET_NETWORK_socket_shutdown (connection->sock, 
SHUT_RDWR)) &&
+    if ((GNUNET_OK !=
+         GNUNET_NETWORK_socket_shutdown (connection->sock,
+                                         SHUT_RDWR)) &&
        (ENOTCONN != errno) &&
        (ECONNRESET != errno) )
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown");
+      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
+                    "shutdown");
   }
   if (NULL != connection->sock)
   {
     if (GNUNET_YES != connection->persist)
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close 
(connection->sock));
+    {
+      GNUNET_break (GNUNET_OK ==
+                    GNUNET_NETWORK_socket_close (connection->sock));
+    }
     else
     {
       GNUNET_NETWORK_socket_free_memory_only_ (connection->sock); /* at least 
no memory leak (we deliberately
@@ -1079,7 +1096,9 @@
   }
   GNUNET_assert (GNUNET_NETWORK_fdset_isset (tc->read_ready, 
connection->sock));
 RETRY:
-  ret = GNUNET_NETWORK_socket_recv (connection->sock, buffer, connection->max);
+  ret = GNUNET_NETWORK_socket_recv (connection->sock,
+                                    buffer,
+                                    connection->max);
   if (-1 == ret)
   {
     if (EINTR == errno)
@@ -1088,11 +1107,20 @@
     return;
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "receive_ready read %u/%u bytes from `%s' (%p)!\n", (unsigned int) ret,
-       connection->max, GNUNET_a2s (connection->addr, connection->addrlen), 
connection);
+       "receive_ready read %u/%u bytes from `%s' (%p)!\n",
+       (unsigned int) ret,
+       connection->max,
+       GNUNET_a2s (connection->addr,
+                   connection->addrlen),
+       connection);
   GNUNET_assert (NULL != (receiver = connection->receiver));
   connection->receiver = NULL;
-  receiver (connection->receiver_cls, buffer, ret, connection->addr, 
connection->addrlen, 0);
+  receiver (connection->receiver_cls,
+            buffer,
+            ret,
+            connection->addr,
+            connection->addrlen,
+            0);
 }
 
 
@@ -1398,7 +1426,7 @@
  * @param timeout after how long should we give up (and call
  *        notify with buf NULL and size 0)?
  * @param notify function to call
- * @param notify_cls closure for notify
+ * @param notify_cls closure for @a notify
  * @return non-NULL if the notify callback was queued,
  *         NULL if we are already going to notify someone else (busy)
  */
@@ -1431,7 +1459,8 @@
   {
     if (NULL != connection->write_task)
       GNUNET_SCHEDULER_cancel (connection->write_task);
-    connection->write_task = GNUNET_SCHEDULER_add_now (&connect_error, 
connection);
+    connection->write_task = GNUNET_SCHEDULER_add_now (&connect_error,
+                                                       connection);
     return &connection->nth;
   }
   if (NULL != connection->write_task)
@@ -1439,7 +1468,9 @@
   if (NULL != connection->sock)
   {
     /* connected, try to transmit now */
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling transmission (%p).\n", 
connection);
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Scheduling transmission (%p).\n",
+         connection);
     connection->write_task =
         GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining
                                         (connection->nth.transmit_timeout),
@@ -1448,9 +1479,11 @@
   }
   /* not yet connected, wait for connection */
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Need to wait to schedule transmission for connection, adding timeout 
task (%p).\n", connection);
+       "Need to wait to schedule transmission for connection, adding timeout 
task (%p).\n",
+       connection);
   connection->nth.timeout_task =
-    GNUNET_SCHEDULER_add_delayed (timeout, &transmit_timeout, connection);
+    GNUNET_SCHEDULER_add_delayed (timeout,
+                                  &transmit_timeout, connection);
   return &connection->nth;
 }
 

Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c   2015-02-21 12:45:28 UTC (rev 35291)
+++ gnunet/src/util/network.c   2015-02-21 20:21:40 UTC (rev 35292)
@@ -973,10 +973,10 @@
 
   ret = shutdown (desc->fd, how);
 #ifdef MINGW
-  if (ret != 0)
+  if (0 != ret)
     SetErrnoFromWinsockError (WSAGetLastError ());
 #endif
-  return ret == 0 ? GNUNET_OK : GNUNET_SYSERR;
+  return (0 == ret) ? GNUNET_OK : GNUNET_SYSERR;
 }
 
 

Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c    2015-02-21 12:45:28 UTC (rev 35291)
+++ gnunet/src/util/server.c    2015-02-21 20:21:40 UTC (rev 35292)
@@ -479,10 +479,13 @@
        * fail if we already took the port on IPv6; if both IPv4 and
        * IPv6 binds fail, then our caller will log using the
        * errno preserved in 'eno' */
-      LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "bind");
+      LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
+                    "bind");
       if (0 != port)
-        LOG (GNUNET_ERROR_TYPE_ERROR, _("`%s' failed for port %d (%s).\n"),
-             "bind", port,
+        LOG (GNUNET_ERROR_TYPE_ERROR,
+             _("`%s' failed for port %d (%s).\n"),
+             "bind",
+             port,
              (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
       eno = 0;
     }
@@ -507,13 +510,15 @@
   }
   if (GNUNET_OK != GNUNET_NETWORK_socket_listen (sock, 5))
   {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "listen");
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
+                  "listen");
     GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
     errno = 0;
     return NULL;
   }
   if (0 != port)
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Server starts to listen on port %u.\n",
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Server starts to listen on port %u.\n",
          port);
   return sock;
 }
@@ -620,7 +625,7 @@
   {
     lsocks = NULL;
   }
-  return GNUNET_SERVER_create_with_sockets (access_cb, 
+  return GNUNET_SERVER_create_with_sockets (access_cb,
                                            access_cb_cls,
                                            lsocks,
                                             idle_timeout,
@@ -1040,7 +1045,8 @@
  *            #GNUNET_SYSERR if we should instantly abort due to error in a 
previous step
  */
 static void
-process_mst (struct GNUNET_SERVER_Client *client, int ret)
+process_mst (struct GNUNET_SERVER_Client *client,
+             int ret)
 {
   while ((GNUNET_SYSERR != ret) && (NULL != client->server) &&
          (GNUNET_YES != client->shutdown_now) && (0 == client->suspended))
@@ -1053,7 +1059,8 @@
       client->receive_pending = GNUNET_YES;
       GNUNET_CONNECTION_receive (client->connection,
                                  GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
-                                 client->idle_timeout, &process_incoming,
+                                 client->idle_timeout,
+                                 &process_incoming,
                                  client);
       break;
     }
@@ -1092,12 +1099,16 @@
  * @param buf buffer with data received from network
  * @param available number of bytes available in buf
  * @param addr address of the sender
- * @param addrlen length of addr
+ * @param addrlen length of @a addr
  * @param errCode code indicating errors receiving, 0 for success
  */
 static void
-process_incoming (void *cls, const void *buf, size_t available,
-                  const struct sockaddr *addr, socklen_t addrlen, int errCode)
+process_incoming (void *cls,
+                  const void *buf,
+                  size_t available,
+                  const struct sockaddr *addr,
+                  socklen_t addrlen,
+                  int errCode)
 {
   struct GNUNET_SERVER_Client *client = cls;
   struct GNUNET_SERVER_Handle *server = client->server;
@@ -1108,17 +1119,22 @@
   GNUNET_assert (GNUNET_YES == client->receive_pending);
   client->receive_pending = GNUNET_NO;
   now = GNUNET_TIME_absolute_get ();
-  end = GNUNET_TIME_absolute_add (client->last_activity, client->idle_timeout);
+  end = GNUNET_TIME_absolute_add (client->last_activity,
+                                  client->idle_timeout);
 
-  if ((NULL == buf) && (0 == available) && (NULL == addr) && (0 == errCode) &&
-      (GNUNET_YES != client->shutdown_now) && (NULL != server) &&
-      (GNUNET_YES == GNUNET_CONNECTION_check (client->connection)) &&
-      (end.abs_value_us > now.abs_value_us))
+  if ( (NULL == buf) &&
+       (0 == available) &&
+       (NULL == addr) &&
+       (0 == errCode) &&
+       (GNUNET_YES != client->shutdown_now) &&
+       (NULL != server) &&
+       (GNUNET_YES == GNUNET_CONNECTION_check (client->connection)) &&
+       (end.abs_value_us > now.abs_value_us) )
   {
     /* wait longer, timeout changed (i.e. due to us sending) */
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Receive time out, but no disconnect due to sending (%p)\n",
-         GNUNET_a2s (addr, addrlen));
+         client);
     client->receive_pending = GNUNET_YES;
     GNUNET_CONNECTION_receive (client->connection,
                                GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
@@ -1126,27 +1142,45 @@
                                &process_incoming, client);
     return;
   }
-  if ((NULL == buf) || (0 == available) || (0 != errCode) || (NULL == server) 
||
-      (GNUNET_YES == client->shutdown_now) ||
-      (GNUNET_YES != GNUNET_CONNECTION_check (client->connection)))
+  if ( (NULL == buf) ||
+       (0 == available) ||
+       (0 != errCode) ||
+       (NULL == server) ||
+       (GNUNET_YES == client->shutdown_now) ||
+       (GNUNET_YES != GNUNET_CONNECTION_check (client->connection)) )
   {
     /* other side closed connection, error connecting, etc. */
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Failed to connect or other side closed connection (%p)\n",
+         client);
     GNUNET_SERVER_client_disconnect (client);
     return;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Server receives %u bytes from `%s'.\n",
-       (unsigned int) available, GNUNET_a2s (addr, addrlen));
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Server receives %u bytes from `%s'.\n",
+       (unsigned int) available,
+       GNUNET_a2s (addr, addrlen));
   GNUNET_SERVER_client_keep (client);
   client->last_activity = now;
 
   if (NULL != server->mst_receive)
-    ret =
-        client->server->mst_receive (client->server->mst_cls, client->mst,
-                                     client, buf, available, GNUNET_NO, 
GNUNET_YES);
+  {
+    ret = client->server->mst_receive (client->server->mst_cls,
+                                       client->mst,
+                                       client,
+                                       buf,
+                                       available,
+                                       GNUNET_NO,
+                                       GNUNET_YES);
+  }
   else if (NULL != client->mst)
   {
     ret =
-        GNUNET_SERVER_mst_receive (client->mst, client, buf, available, 
GNUNET_NO,
+        GNUNET_SERVER_mst_receive (client->mst,
+                                   client,
+                                   buf,
+                                   available,
+                                   GNUNET_NO,
                                    GNUNET_YES);
   }
   else
@@ -1154,8 +1188,8 @@
     GNUNET_break (0);
     return;
   }
-
-  process_mst (client, ret);
+  process_mst (client,
+               ret);
   GNUNET_SERVER_client_drop (client);
 }
 
@@ -1164,11 +1198,12 @@
  * Task run to start again receiving from the network
  * and process requests.
  *
- * @param cls our 'struct GNUNET_SERVER_Client*' to process more requests from
+ * @param cls our `struct GNUNET_SERVER_Client *` to process more requests from
  * @param tc scheduler context (unused)
  */
 static void
-restart_processing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_processing (void *cls,
+                    const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_SERVER_Client *client = cls;
 
@@ -1180,14 +1215,17 @@
     client->receive_pending = GNUNET_YES;
     GNUNET_CONNECTION_receive (client->connection,
                                GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
-                               client->idle_timeout, &process_incoming, 
client);
+                               client->idle_timeout,
+                               &process_incoming,
+                               client);
     return;
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Server continues processing messages still in the buffer.\n");
   GNUNET_SERVER_client_keep (client);
   client->receive_pending = GNUNET_NO;
-  process_mst (client, GNUNET_NO);
+  process_mst (client,
+               GNUNET_NO);
   GNUNET_SERVER_client_drop (client);
 }
 
@@ -1258,15 +1296,17 @@
         server->mst_create (server->mst_cls, client);
   else
     client->mst =
-        GNUNET_SERVER_mst_create (&client_message_tokenizer_callback, server);
+        GNUNET_SERVER_mst_create (&client_message_tokenizer_callback,
+                                  server);
   GNUNET_assert (NULL != client->mst);
   for (n = server->connect_notify_list_head; NULL != n; n = n->next)
     n->callback (n->callback_cls, client);
-
   client->receive_pending = GNUNET_YES;
   GNUNET_CONNECTION_receive (client->connection,
                              GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
-                             client->idle_timeout, &process_incoming, client);
+                             client->idle_timeout,
+                             &process_incoming,
+                             client);
   return client;
 }
 
@@ -1572,7 +1612,7 @@
  * Wrapper for transmission notification that calls the original
  * callback and update the last activity time for our connection.
  *
- * @param cls the `struct GNUNET_SERVER_Client`
+ * @param cls the `struct GNUNET_SERVER_Client *`
  * @param size number of bytes we can transmit
  * @param buf where to copy the message
  * @return number of bytes actually transmitted




reply via email to

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