Skip to content

Commit

Permalink
Reveal R on session termination
Browse files Browse the repository at this point in the history
If a session was terminated prematurely(for example, by consumer) the last promise might not get revealed until the consumer would connect to us again.

This PR alleviates the problem somewhat by always trying to reveal R before exiting.
  • Loading branch information
vkuznecovas committed Jan 30, 2020
1 parent d367d5e commit c1051b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions session/pingpong/invoice_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ func (it *InvoiceTracker) Start() error {
emErrors <- it.listenForExchangeMessages()
}()

// on session close, try and reveal the promise before exiting
defer it.revealPromise()

// give the consumer a second to start up his payments before sending the first request
firstSend := time.After(time.Second)
for {
Expand Down

0 comments on commit c1051b2

Please sign in to comment.