Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Jan 8, 2025
1 parent dc3f9b7 commit d782dd5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ export class OceanP2P extends EventEmitter {
}

async findPeerInDht(peerName: string, timeout?: number) {
const peer = peerIdFromString(peerName)
try {
const peer = peerIdFromString(peerName)
const data = await this._libp2p.peerRouting.findPeer(peer, {
signal:
isNaN(timeout) || timeout === 0
Expand Down
3 changes: 2 additions & 1 deletion src/components/httpRoutes/getOceanPeers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ getOceanPeersRoute.get(
const peers = await req.oceanNode
.getP2PNode()
.findPeerInDht(String(req.query.peerId), parseInt(String(req.query.timeout)))
res.json(peers)
if (peers) res.json(peers)
else res.sendStatus(404).send('Cannot find peer')
} else {
sendMissingP2PResponse(res)
}
Expand Down

0 comments on commit d782dd5

Please sign in to comment.