Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
remove rollback logic when writing reservation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jul 6, 2021
1 parent c42f8b6 commit 2a0c38e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions v2/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,9 @@ func (r *Relay) handleReserve(s network.Stream) {

log.Debugf("reserving relay slot for %s", p)

err := r.writeResponse(s, pbv2.Status_OK, r.makeReservationMsg(p, expire), r.makeLimitMsg(p))
if err != nil {
s.Reset()
if err := r.writeResponse(s, pbv2.Status_OK, r.makeReservationMsg(p, expire), r.makeLimitMsg(p)); err != nil {
log.Debugf("error writing reservation response; retracting reservation for %s", p)
r.mx.Lock()
delete(r.rsvp, p)
r.ipcs.RemoveReservation(p)
r.host.ConnManager().UntagPeer(p, "relay-reservation")
r.mx.Unlock()
s.Reset()
}
}

Expand Down

0 comments on commit 2a0c38e

Please sign in to comment.