get-info -> get-peerinfo
This commit is contained in:
parent
3d40ddec85
commit
7c010f9303
|
@ -31,7 +31,7 @@ type
|
||||||
args: string
|
args: string
|
||||||
|
|
||||||
# Server messages
|
# Server messages
|
||||||
OkGetInfo* = object
|
OkGetPeerinfo* = object
|
||||||
ip: string
|
ip: string
|
||||||
ports: array[3, uint16]
|
ports: array[3, uint16]
|
||||||
OkGetEndpoint* = object
|
OkGetEndpoint* = object
|
||||||
|
@ -147,8 +147,8 @@ proc handlePeerNotifications(serverConn: ServerConnection,
|
||||||
proc punchHole(punchdConn: PunchdConnection, serverConn: ServerConnection,
|
proc punchHole(punchdConn: PunchdConnection, serverConn: ServerConnection,
|
||||||
peerId: string, otherPeerId: string):
|
peerId: string, otherPeerId: string):
|
||||||
Future[AsyncSocket] {.async.} =
|
Future[AsyncSocket] {.async.} =
|
||||||
let sResp = await serverConn.sendRequest("get-info", otherPeerId)
|
let sResp = await serverConn.sendRequest("get-peerinfo", otherPeerId)
|
||||||
let peerInfo = parseMessage[OkGetInfo](sResp)
|
let peerInfo = parseMessage[OkGetPeerinfo](sResp)
|
||||||
proc progressCb(future: PunchdResponse, msgContent: string) {.async.} =
|
proc progressCb(future: PunchdResponse, msgContent: string) {.async.} =
|
||||||
try:
|
try:
|
||||||
let parsedResp = parseMessage[ProgressTcpSyniConnect](msgContent)
|
let parsedResp = parseMessage[ProgressTcpSyniConnect](msgContent)
|
||||||
|
|
|
@ -17,7 +17,7 @@ type
|
||||||
ip: IpAddress
|
ip: IpAddress
|
||||||
ports: array[3, Port]
|
ports: array[3, Port]
|
||||||
|
|
||||||
GetInfo = object
|
GetPeerinfo = object
|
||||||
peerId: string
|
peerId: string
|
||||||
|
|
||||||
NotifyPeer = object
|
NotifyPeer = object
|
||||||
|
@ -94,9 +94,8 @@ proc processClient(client: AsyncSocket,
|
||||||
asyncCheck client.sendEndpoint(id)
|
asyncCheck client.sendEndpoint(id)
|
||||||
removeClient(clients, peerId)
|
removeClient(clients, peerId)
|
||||||
break
|
break
|
||||||
# FIXME: get-peerinfo
|
of "get-peerinfo":
|
||||||
of "get-info":
|
let req = parseMessage[GetPeerinfo](args[2])
|
||||||
let req = parseMessage[GetInfo](args[2])
|
|
||||||
echo "get-info: ", req
|
echo "get-info: ", req
|
||||||
let peer = clients[req.peerId]
|
let peer = clients[req.peerId]
|
||||||
let peerPorts = peer.ports.join(",")
|
let peerPorts = peer.ports.join(",")
|
||||||
|
|
Loading…
Reference in New Issue