Skip to content

Commit

Permalink
fix: Set missing deadlines (#2794)
Browse files Browse the repository at this point in the history
* Set missing deadlines

* Revert changes to gostream. Not the right place
  • Loading branch information
MarcoPolo committed May 16, 2024
1 parent 5d547cf commit 93d5c2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions p2p/protocol/circuitv2/client/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions p2p/protocol/circuitv2/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93d5c2e

Please sign in to comment.