浏览代码

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

Grant Limberg 6 年之前
父节点
当前提交
203414910f
共有 1 个文件被更改,包括 4 次插入0 次删除
  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
 #endif
 
 
 	int interface_index = _indexForInterface(iface);
 	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) {
 	if (interface_index == -1) {
 		fprintf(stderr, "Unable to find index for interface %s\n", iface);
 		fprintf(stderr, "Unable to find index for interface %s\n", iface);