gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35321 - gnunet/src/util
Date: Sat, 28 Feb 2015 19:58:49 +0100

Author: grothoff
Date: 2015-02-28 19:58:49 +0100 (Sat, 28 Feb 2015)
New Revision: 35321

Modified:
   gnunet/src/util/connection.c
   gnunet/src/util/server.c
Log:
-indentation, comments

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2015-02-28 18:49:25 UTC (rev 35320)
+++ gnunet/src/util/connection.c        2015-02-28 18:58:49 UTC (rev 35321)
@@ -245,7 +245,7 @@
   int8_t persist;
 
   /**
-   * Usually 0.  Set to 1 if this handle is in used and should
+   * Usually 0.  Set to 1 if this handle is in use, and should
    * #GNUNET_CONNECTION_destroy() be called right now, the action needs
    * to be deferred by setting it to -1.
    */
@@ -984,7 +984,10 @@
 {
   if ((NULL != connection->ap_head) || (NULL != connection->dns_active))
     return GNUNET_YES;          /* still trying to connect */
-  return (NULL == connection->sock) ? GNUNET_NO : GNUNET_YES;
+  if ( (0 != connection->destroy_later) ||
+       (NULL == connection->sock) )
+    return GNUNET_NO;
+  return GNUNET_YES;
 }
 
 
@@ -1078,7 +1081,8 @@
  * @param tc scheduler context
  */
 static void
-receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+receive_ready (void *cls,
+               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CONNECTION_Handle *connection = cls;
   char buffer[connection->max];
@@ -1172,8 +1176,10 @@
   {
     connection->read_task =
       GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining
-                                     (connection->receive_timeout), 
connection->sock,
-                                     &receive_ready, connection);
+                                     (connection->receive_timeout),
+                                     connection->sock,
+                                     &receive_ready,
+                                     connection);
     return;
   }
   if ((NULL == connection->dns_active) && (NULL == connection->ap_head))
@@ -1198,7 +1204,8 @@
 {
   if (NULL != connection->read_task)
   {
-    GNUNET_assert (connection == GNUNET_SCHEDULER_cancel 
(connection->read_task));
+    GNUNET_assert (connection ==
+                   GNUNET_SCHEDULER_cancel (connection->read_task));
     connection->read_task = NULL;
   }
   connection->receiver = NULL;
@@ -1243,7 +1250,8 @@
   if (connection->write_buffer_size - connection->write_buffer_off < size)
   {
     /* need to compact */
-    memmove (connection->write_buffer, 
&connection->write_buffer[connection->write_buffer_pos],
+    memmove (connection->write_buffer,
+             &connection->write_buffer[connection->write_buffer_pos],
              used);
     connection->write_buffer_off -= connection->write_buffer_pos;
     connection->write_buffer_pos = 0;
@@ -1272,7 +1280,8 @@
  * @param tc scheduler context
  */
 static void
-transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_timeout (void *cls,
+                  const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CONNECTION_Handle *connection = cls;
   GNUNET_CONNECTION_TransmitReadyNotify notify;
@@ -1281,7 +1290,10 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Transmit to `%s:%u/%s' fails, time out reached (%p).\n",
        connection->hostname,
-       connection->port, GNUNET_a2s (connection->addr, connection->addrlen), 
connection);
+       connection->port,
+       GNUNET_a2s (connection->addr,
+                   connection->addrlen),
+       connection);
   notify = connection->nth.notify_ready;
   GNUNET_assert (NULL != notify);
   connection->nth.notify_ready = NULL;
@@ -1299,14 +1311,18 @@
  * @param tc scheduler context
  */
 static void
-connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_error (void *cls,
+               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CONNECTION_Handle *connection = cls;
   GNUNET_CONNECTION_TransmitReadyNotify notify;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Transmission request of size %u fails (%s/%u), connection failed 
(%p).\n",
-       connection->nth.notify_size, connection->hostname, connection->port, 
connection);
+       connection->nth.notify_size,
+       connection->hostname,
+       connection->port,
+       connection);
   connection->write_task = NULL;
   notify = connection->nth.notify_ready;
   connection->nth.notify_ready = NULL;
@@ -1519,9 +1535,7 @@
  * @param th notification to cancel
  */
 void
-GNUNET_CONNECTION_notify_transmit_ready_cancel (struct
-                                                
GNUNET_CONNECTION_TransmitHandle
-                                                *th)
+GNUNET_CONNECTION_notify_transmit_ready_cancel (struct 
GNUNET_CONNECTION_TransmitHandle *th)
 {
   GNUNET_assert (NULL != th->notify_ready);
   th->notify_ready = NULL;

Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c    2015-02-28 18:49:25 UTC (rev 35320)
+++ gnunet/src/util/server.c    2015-02-28 18:58:49 UTC (rev 35321)
@@ -1136,7 +1136,8 @@
     GNUNET_CONNECTION_receive (client->connection,
                                GNUNET_SERVER_MAX_MESSAGE_SIZE - 1,
                                GNUNET_TIME_absolute_get_remaining (end),
-                               &process_incoming, client);
+                               &process_incoming,
+                               client);
     return;
   }
   if ( (NULL == buf) ||
@@ -1656,8 +1657,8 @@
 GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
                                      size_t size,
                                      struct GNUNET_TIME_Relative timeout,
-                                     GNUNET_CONNECTION_TransmitReadyNotify
-                                     callback, void *callback_cls)
+                                     GNUNET_CONNECTION_TransmitReadyNotify 
callback,
+                                     void *callback_cls)
 {
   if (NULL != client->th.callback)
     return NULL;
@@ -1753,7 +1754,8 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "GNUNET_SERVER_receive_done causes restart in reading from the 
socket\n");
   GNUNET_assert (NULL == client->restart_task);
-  client->restart_task = GNUNET_SCHEDULER_add_now (&restart_processing, 
client);
+  client->restart_task = GNUNET_SCHEDULER_add_now (&restart_processing,
+                                                   client);
 }
 
 




reply via email to

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