[Cryptech-Commits] [sw/libhal] 03/04: Retry a couple of times on HAL_ERROR_CORE_BUSY. This doesn't guarantee success, but reduces the failure rate on a busy server.

git at cryptech.is git at cryptech.is
Mon Apr 17 20:37:52 UTC 2017


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

paul at psgd.org pushed a commit to branch ksng
in repository sw/libhal.

commit c2820e99c1e3115a7b1ba0d993eb6b665fa73c17
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Mon Apr 17 15:05:38 2017 -0400

    Retry a couple of times on HAL_ERROR_CORE_BUSY. This doesn't guarantee success, but reduces the failure rate on a busy server.
---
 rpc_server.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/rpc_server.c b/rpc_server.c
index d946b06..b28f90c 100644
--- a/rpc_server.c
+++ b/rpc_server.c
@@ -3,7 +3,7 @@
  * ------------
  * Remote procedure call server-side private API implementation.
  *
- * Copyright (c) 2016, NORDUnet A/S All rights reserved.
+ * Copyright (c) 2016-2017, NORDUnet A/S All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -966,7 +966,13 @@ hal_error_t hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ile
     }
 
     if (handler)
-        ret = handler(&iptr, ilimit, &optr, olimit);
+        for (int i = 0; i < 3; ++i) {
+            ret = handler(&iptr, ilimit, &optr, olimit);
+            if (ret != HAL_ERROR_CORE_BUSY)
+                break;
+            iptr = ibuf + 4;
+            optr = obuf + 12;
+        }
     else
         ret = HAL_ERROR_RPC_BAD_FUNCTION;
 



More information about the Commits mailing list