Skip to content

Commit

Permalink
Fixed unsafe convertion to string
Browse files Browse the repository at this point in the history
  • Loading branch information
glblduh committed May 25, 2022
1 parent eeb784b commit 511a2a7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,15 @@ func apiTorrentStats(w http.ResponseWriter, r *http.Request) {

/* Setting the peers info */
for _, peer := range v.Torrent.PeerConns() {
paddr := peer.Peer.RemoteAddr.String()
pcli, ok := peer.Peer.PeerClientName.Load().(string)
if !ok {
pcli = "NOTPROVIDED"
}

tstats.Peers = append(tstats.Peers, apiTorrentStatsPeersInfo{
PeerAddr: peer.Peer.RemoteAddr.String(),
PeerClient: peer.Peer.PeerClientName.Load().(string),
PeerAddr: paddr,
PeerClient: pcli,
})
}

Expand Down

0 comments on commit 511a2a7

Please sign in to comment.