get-info -> get-peerinfo

This commit is contained in:
Christian Ulrich 2020-07-26 17:48:47 +02:00
parent 3d40ddec85
commit 7c010f9303
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
2 changed files with 6 additions and 7 deletions

View File

@ -31,7 +31,7 @@ type
args: string
# Server messages
OkGetInfo* = object
OkGetPeerinfo* = object
ip: string
ports: array[3, uint16]
OkGetEndpoint* = object
@ -147,8 +147,8 @@ proc handlePeerNotifications(serverConn: ServerConnection,
proc punchHole(punchdConn: PunchdConnection, serverConn: ServerConnection,
peerId: string, otherPeerId: string):
Future[AsyncSocket] {.async.} =
let sResp = await serverConn.sendRequest("get-info", otherPeerId)
let peerInfo = parseMessage[OkGetInfo](sResp)
let sResp = await serverConn.sendRequest("get-peerinfo", otherPeerId)
let peerInfo = parseMessage[OkGetPeerinfo](sResp)
proc progressCb(future: PunchdResponse, msgContent: string) {.async.} =
try:
let parsedResp = parseMessage[ProgressTcpSyniConnect](msgContent)

View File

@ -17,7 +17,7 @@ type
ip: IpAddress
ports: array[3, Port]
GetInfo = object
GetPeerinfo = object
peerId: string
NotifyPeer = object
@ -94,9 +94,8 @@ proc processClient(client: AsyncSocket,
asyncCheck client.sendEndpoint(id)
removeClient(clients, peerId)
break
# FIXME: get-peerinfo
of "get-info":
let req = parseMessage[GetInfo](args[2])
of "get-peerinfo":
let req = parseMessage[GetPeerinfo](args[2])
echo "get-info: ", req
let peer = clients[req.peerId]
let peerPorts = peer.ports.join(",")