fix segfault
This commit is contained in:
parent
6edf6b7e23
commit
5b79592a62
|
@ -62,7 +62,9 @@ proc getEndpoint(srcPort: Port, serverHostname: string, serverPort: Port):
|
|||
proc initServerConnection*(serverHostname: string, serverPort: Port,
|
||||
srcPort: Port, probingServers: seq[Endpoint]):
|
||||
Future[ServerConnection] {.async.} =
|
||||
result.srcPort = srcPort
|
||||
result = ServerConnection(outMessages: newTable[string, Future[string]](),
|
||||
peerNotifications: newFutureStream[string]("initServerConnection"),
|
||||
srcPort: srcPort)
|
||||
for s in probingServers:
|
||||
let endpoint = await getEndpoint(srcPort, s.hostname, s.port)
|
||||
# FIXME: what if we get get different IPs from different servers
|
||||
|
@ -70,8 +72,6 @@ proc initServerConnection*(serverHostname: string, serverPort: Port,
|
|||
result.probedSrcPorts.add(endpoint.port)
|
||||
result.sock = await asyncnet.dial(serverHostname,
|
||||
serverPort)
|
||||
result.outMessages = newTable[string, Future[string]]()
|
||||
result.peerNotifications = newFutureStream[string]("initServerConnection")
|
||||
|
||||
proc handleServerMessages*(conn: ServerConnection) {.async.} =
|
||||
while true:
|
||||
|
|
Loading…
Reference in New Issue