Make client ID random in example
This commit is contained in:
+4
-1
@@ -15,6 +15,7 @@
|
|||||||
* LD_LIBRARY_PATH=. ./example
|
* LD_LIBRARY_PATH=. ./example
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -36,6 +37,8 @@ static const char *error_name(ToastyFS_Error e)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
/* Cluster addresses (mapped via docker-compose ports).
|
/* Cluster addresses (mapped via docker-compose ports).
|
||||||
* These must be writable char arrays because parse_addr_arg
|
* These must be writable char arrays because parse_addr_arg
|
||||||
* temporarily modifies the string in-place. */
|
* temporarily modifies the string in-place. */
|
||||||
@@ -45,7 +48,7 @@ int main(void)
|
|||||||
char *addrs[] = { addr1, addr2, addr3 };
|
char *addrs[] = { addr1, addr2, addr3 };
|
||||||
|
|
||||||
printf("Connecting to cluster...\n");
|
printf("Connecting to cluster...\n");
|
||||||
ToastyFS *tfs = toastyfs_init(1, addrs, 3);
|
ToastyFS *tfs = toastyfs_init(rand(), addrs, 3);
|
||||||
if (tfs == NULL) {
|
if (tfs == NULL) {
|
||||||
fprintf(stderr, "toastyfs_init failed\n");
|
fprintf(stderr, "toastyfs_init failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user