Browse Source

RPC: Use struct timeval for mcast bind timer

Luke Dashjr 11 years ago
parent
commit
38f54e604f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      api.c

+ 3 - 3
api.c

@@ -3683,7 +3683,7 @@ static void mcast()
 	struct sockaddr_in listen;
 	struct ip_mreq grp;
 	struct sockaddr_in came_from;
-	time_t bindstart;
+	struct timeval bindstart;
 	const char *binderror;
 	SOCKETTYPE mcast_sock;
 	SOCKETTYPE reply_sock;
@@ -3723,11 +3723,11 @@ static void mcast()
 
 	// try for more than 1 minute ... in case the old one hasn't completely gone yet
 	bound = 0;
-	bindstart = time(NULL);
+	timer_set_now(&bindstart);
 	while (bound == 0) {
 		if (SOCKETFAIL(bind(mcast_sock, (struct sockaddr *)(&listen), sizeof(listen)))) {
 			binderror = SOCKERRMSG;
-			if ((time(NULL) - bindstart) > 61)
+			if (timer_elapsed(&bindstart, NULL) > 61)
 				break;
 			else
 				cgsleep_ms(30000);