Skip to content

Commit

Permalink
fix peer.AddrInfo cast
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy committed Jun 21, 2024
1 parent 7981454 commit c8af9fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion network/limitcaller/rateLimitingTransport.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ func (r *RateLimitingTransport) RoundTrip(req *http.Request) (res *http.Response
addrOrPeerID := req.Host
// p2p/http clients have per-connection transport and address info so use that
if len(req.Host) == 0 && req.URL != nil && len(req.URL.Host) == 0 {
addrOrPeerID = string(r.targetAddr.(*peer.AddrInfo).ID)
addrInfo, ok := r.targetAddr.(*peer.AddrInfo)
if !ok {
return nil, errors.New("rateLimitingTransport: request without Host/URL and targetAddr is not a peer.AddrInfo")
}
addrOrPeerID = string(addrInfo.ID)
}
for {
_, waitTime, provisionalTime = r.phonebook.GetConnectionWaitTime(addrOrPeerID)
Expand Down

0 comments on commit c8af9fb

Please sign in to comment.