aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/util
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/util')
-rw-r--r--test/core/util/port_posix.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 732a51c5cb..0666a60c66 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,11 +37,12 @@
#include "test/core/util/port.h"
+#include <errno.h>
+#include <math.h>
#include <netinet/in.h>
-#include <sys/socket.h>
#include <stdio.h>
-#include <errno.h>
#include <string.h>
+#include <sys/socket.h>
#include <unistd.h>
#include <grpc/grpc.h>
@@ -229,10 +230,10 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
grpc_httpcli_request req;
memset(&req, 0, sizeof(req));
GPR_ASSERT(pr->retries < 10);
+ sleep(1 + (unsigned)(pow(1.3, pr->retries) * rand() / RAND_MAX));
pr->retries++;
req.host = pr->server;
req.path = "/get";
- sleep(1);
grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pollset, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), got_port_from_server,
pr);