Merge pull request 'zerotier generate: kill process group' (#793) from lassulus-zerotier-kill-pg into main
This commit is contained in:
@@ -7,6 +7,7 @@ import os
|
|||||||
import signal
|
import signal
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
@@ -148,9 +149,15 @@ class NetworkController:
|
|||||||
|
|
||||||
# TODO: allow merging more network configuration here
|
# TODO: allow merging more network configuration here
|
||||||
def create_network_controller() -> NetworkController:
|
def create_network_controller() -> NetworkController:
|
||||||
with zerotier_controller() as controller:
|
e = ClanError("Bug, should never happen")
|
||||||
network = controller.create_network()
|
for _ in range(10):
|
||||||
return NetworkController(network["nwid"], controller.identity)
|
try:
|
||||||
|
with zerotier_controller() as controller:
|
||||||
|
network = controller.create_network()
|
||||||
|
return NetworkController(network["nwid"], controller.identity)
|
||||||
|
except ClanError: # probably failed to allocate port, so retry
|
||||||
|
print("failed to create network, retrying..., probabl", file=sys.stderr)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def create_identity() -> Identity:
|
def create_identity() -> Identity:
|
||||||
|
|||||||
Reference in New Issue
Block a user