X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fphp%2Fext%2Fgrpc%2Fcall.c;h=1abc4a3faf774317f0b7b236f8a1b7dc1f0197f7;hb=71f640b484f7b64c4f023c2601b378b958144f9e;hp=e1b81f316b2406de68ef7296bc9da8e59618916a;hpb=754713aa17cd9d27a649dd3a8a1657ddb01bca1a;p=platform%2Fupstream%2Fgrpc.git diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index e1b81f3..1abc4a3 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -294,7 +294,7 @@ PHP_METHOD(Call, startBatch) { grpc_status_code status; grpc_slice recv_status_details = grpc_empty_slice(); grpc_slice send_status_details = grpc_empty_slice(); - grpc_byte_buffer *message; + grpc_byte_buffer *message = NULL; int cancelled; grpc_call_error error; @@ -314,6 +314,11 @@ PHP_METHOD(Call, startBatch) { goto cleanup; } + // c-core may call rand(). If we don't call srand() here, all the + // random numbers being returned would be the same. + gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); + srand(now.tv_nsec); + array_hash = Z_ARRVAL_P(array); char *key = NULL;