gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: handle revoke followed immediate


From: gnunet
Subject: [taler-exchange] branch master updated: handle revoke followed immediately by a sign request
Date: Wed, 24 Nov 2021 17:44:31 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 0ac1b7ab handle revoke followed immediately by a sign request
0ac1b7ab is described below

commit 0ac1b7abad70ed2619393a64601e139fd0623f6e
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Nov 22 15:19:59 2021 +0100

    handle revoke followed immediately by a sign request
---
 src/bank-lib/fakebank.c                |  16 ++---
 src/testing/testing_api_cmd_withdraw.c |   4 +-
 src/util/secmod_common.c               | 104 +++++++++++++++++----------------
 3 files changed, 65 insertions(+), 59 deletions(-)

diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index cc3281c0..e0d8e155 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -1678,8 +1678,8 @@ parse_history_common_args (const struct 
TALER_FAKEBANK_Handle *h,
                                         MHD_HTTP_BAD_REQUEST,
                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                         "delta"))
-      ? GNUNET_NO
-      : GNUNET_SYSERR;
+           ? GNUNET_NO
+           : GNUNET_SYSERR;
   }
   if ( (NULL != long_poll_ms) &&
        (1 != sscanf (long_poll_ms,
@@ -1697,8 +1697,8 @@ parse_history_common_args (const struct 
TALER_FAKEBANK_Handle *h,
                                         MHD_HTTP_BAD_REQUEST,
                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                         "long_poll_ms"))
-      ? GNUNET_NO
-      : GNUNET_SYSERR;
+           ? GNUNET_NO
+           : GNUNET_SYSERR;
   }
   if ( (NULL != start) &&
        (1 != sscanf (start,
@@ -1716,8 +1716,8 @@ parse_history_common_args (const struct 
TALER_FAKEBANK_Handle *h,
                                         MHD_HTTP_BAD_REQUEST,
                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                         "start"))
-      ? GNUNET_NO
-      : GNUNET_SYSERR;
+           ? GNUNET_NO
+           : GNUNET_SYSERR;
   }
   if (NULL == start)
     ha->start_idx = (d > 0) ? 0 : h->serial_counter;
@@ -1732,8 +1732,8 @@ parse_history_common_args (const struct 
TALER_FAKEBANK_Handle *h,
                                         MHD_HTTP_BAD_REQUEST,
                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                         "delta"))
-      ? GNUNET_NO
-      : GNUNET_SYSERR;
+           ? GNUNET_NO
+           : GNUNET_SYSERR;
   }
   ha->lp_timeout
     = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
diff --git a/src/testing/testing_api_cmd_withdraw.c 
b/src/testing/testing_api_cmd_withdraw.c
index 414e7cea..8e6cba70 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -532,8 +532,8 @@ withdraw_traits (void *cls,
   };
 
   return TALER_TESTING_get_trait ((ws->expected_response_code == MHD_HTTP_OK)
-                                    ? &traits[0] /* we have reserve history */
-                                    : &traits[1],/* skip reserve history */
+                                  ? &traits[0]   /* we have reserve history */
+                                  : &traits[1],  /* skip reserve history */
                                   ret,
                                   trait,
                                   index);
diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c
index ee390640..11d7bf71 100644
--- a/src/util/secmod_common.c
+++ b/src/util/secmod_common.c
@@ -232,63 +232,69 @@ TES_read_work (void *cls,
   size_t off = 0;
   uint16_t msize;
   const struct GNUNET_MessageHeader *hdr;
+  enum GNUNET_GenericReturnValue ret;
 
-  do
+  while (1)
   {
-    ssize_t recv_size;
-
-    recv_size = recv (client->csock,
-                      &buf[off],
-                      sizeof (client->iobuf) - off,
-                      0);
-    if (-1 == recv_size)
+    do
     {
-      if ( (0 == off) &&
-           (EAGAIN == errno) )
-        return GNUNET_NO;
-      if ( (EINTR == errno) ||
-           (EAGAIN == errno) )
+      ssize_t recv_size;
+
+      recv_size = recv (client->csock,
+                        &buf[off],
+                        sizeof (client->iobuf) - off,
+                        0);
+      if (-1 == recv_size)
       {
-        GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG,
-                             "recv");
-        continue;
+        if ( (0 == off) &&
+             (EAGAIN == errno) )
+          return GNUNET_NO;
+        if ( (EINTR == errno) ||
+             (EAGAIN == errno) )
+        {
+          GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG,
+                               "recv");
+          continue;
+        }
+        if (ECONNRESET != errno)
+          GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                               "recv");
+        return GNUNET_SYSERR;
       }
-      if (ECONNRESET != errno)
-        GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
-                             "recv");
-      return GNUNET_SYSERR;
-    }
-    if (0 == recv_size)
-    {
-      /* regular disconnect? */
-      GNUNET_break_op (0 == off);
-      return GNUNET_SYSERR;
-    }
-    off += recv_size;
-    if (off < sizeof (struct GNUNET_MessageHeader))
-      continue;
-    hdr = (const struct GNUNET_MessageHeader *) buf;
-    msize = ntohs (hdr->size);
+      if (0 == recv_size)
+      {
+        /* regular disconnect? */
+        GNUNET_break_op (0 == off);
+        return GNUNET_SYSERR;
+      }
+      off += recv_size;
+      if (off < sizeof (struct GNUNET_MessageHeader))
+        continue;
+      hdr = (const struct GNUNET_MessageHeader *) buf;
+      msize = ntohs (hdr->size);
 #if 0
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Received message of type %u with %u bytes\n",
-                (unsigned int) ntohs (hdr->type),
-                (unsigned int) msize);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Received message of type %u with %u bytes\n",
+                  (unsigned int) ntohs (hdr->type),
+                  (unsigned int) msize);
 #endif
-    if (msize < sizeof (struct GNUNET_MessageHeader))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-  } while (off < msize);
-
-  if (off > msize)
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
+      if (msize < sizeof (struct GNUNET_MessageHeader))
+      {
+        GNUNET_break_op (0);
+        return GNUNET_SYSERR;
+      }
+    } while (off < msize);
+
+    ret = dispatch (client,
+                    hdr);
+    if ( (GNUNET_OK != ret) ||
+         (off == msize) )
+      return ret;
+    memmove (buf,
+             &buf[msize],
+             off - msize);
+    off -= msize;
   }
-  return dispatch (client,
-                   hdr);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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