aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-04-17 15:05:38 -0400
committerPaul Selkirk <paul@psgd.org>2017-04-17 15:05:38 -0400
commitc2820e99c1e3115a7b1ba0d993eb6b665fa73c17 (patch)
tree95e65786dae2bbd97afc08cbeb571000d35da88e
parentf79826a8472a2c133c773048306ae3403390e723 (diff)
Retry a couple of times on HAL_ERROR_CORE_BUSY. This doesn't guarantee success, but reduces the failure rate on a busy server.
-rw-r--r--rpc_server.c10
1 files 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;