wait until socket can be bind

This commit is contained in:
PolynomialDivision 2017-11-22 13:20:39 +01:00
parent 6eee1214a2
commit aa6f72e7ed
2 changed files with 3 additions and 2 deletions

View file

@ -32,10 +32,10 @@ int setup_broadcast_socket(const char *_broadcast_ip, unsigned short _broadcast_
addr->sin_addr.s_addr = inet_addr(_broadcast_ip);
addr->sin_port = htons(_broadcast_port);
if (bind(sock, (struct sockaddr *) addr, sizeof(*addr)) <
while (bind(sock, (struct sockaddr *) addr, sizeof(*addr)) <
0) {
fprintf(stderr, "Binding socket failed!\n");
return -1;
sleep(1);
}
return sock;
}

View file

@ -607,6 +607,7 @@ void update_clients(struct uloop_timeout *t) {
}
void update_hostapd_sockets(struct uloop_timeout *t) {
printf("Updating hostapd sockets!\n");
subscribe_to_hostapd_interfaces(hostapd_dir_glob);
uloop_timeout_set(&hostapd_timer, timeout_config.update_hostapd * 1000);
}