Browse Source

fix: Set missing deadlines (#2794)

* Set missing deadlines

* Revert changes to gostream. Not the right place
gammazero/previous-well-known-resource
Marco Munizaga 6 months ago
committed by GitHub
parent
commit
93d5c2e489
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      p2p/protocol/circuitv2/client/handlers.go
  2. 2
      p2p/protocol/circuitv2/relay/relay.go

2
p2p/protocol/circuitv2/client/handlers.go

@ -22,6 +22,8 @@ func (c *Client) handleStreamV2(s network.Stream) {
defer rd.Close()
writeResponse := func(status pbv2.Status) error {
s.SetWriteDeadline(time.Now().Add(StreamTimeout))
defer s.SetWriteDeadline(time.Time{})
wr := util.NewDelimitedWriter(s)
var msg pbv2.StopMessage

2
p2p/protocol/circuitv2/relay/relay.go

@ -556,6 +556,8 @@ func (r *Relay) handleError(s network.Stream, status pbv2.Status) {
}
func (r *Relay) writeResponse(s network.Stream, status pbv2.Status, rsvp *pbv2.Reservation, limit *pbv2.Limit) error {
s.SetWriteDeadline(time.Now().Add(StreamTimeout))
defer s.SetWriteDeadline(time.Time{})
wr := util.NewDelimitedWriter(s)
var msg pbv2.HopMessage

Loading…
Cancel
Save