Explorar o código

Give up to a second for the interface to appear to assign IP addresses

Grant Limberg %!s(int64=6) %!d(string=hai) anos
pai
achega
203414910f
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      osdep/LinuxNetLink.cpp

+ 4 - 0
osdep/LinuxNetLink.cpp

@@ -850,6 +850,10 @@ void LinuxNetLink::addAddress(const InetAddress &addr, const char *iface)
 #endif
 
 	int interface_index = _indexForInterface(iface);
+	for (int reps = 0; interface_index == -1 && reps < 10; ++reps) {
+		Thread::sleep(100);
+		interface_index == _indexForInterface(iface);
+	}
 
 	if (interface_index == -1) {
 		fprintf(stderr, "Unable to find index for interface %s\n", iface);