mirror of
https://github.com/lightninglabs/pool.git
synced 2026-08-17 13:06:52 +02:00
sidecar: Init mailbox after server restarts
Whenever we are are unable to receive a sidecar packet in an auto sidecar negotiator try to init its mailbox. This will allow us to continue reading/writting in the mailbox in cases where the server went down and came back.
This commit is contained in:
parent
df3b819e5c
commit
ac3c44a966
1 changed files with 32 additions and 0 deletions
|
|
@ -314,6 +314,23 @@ func (a *SidecarNegotiator) autoSidecarReceiver(ctx context.Context,
|
|||
|
||||
select {
|
||||
case <-retryTimer.backOff(backoffLabel):
|
||||
// It is possible that we were not able to receive the
|
||||
// packet because the server went down. In that case,
|
||||
// we will try to init the sidecar mailbox again.
|
||||
// There is no need to log/check this error. There are
|
||||
// three possibilities:
|
||||
//
|
||||
// 1) If the error was not related with the sever being
|
||||
// down, we will get an `AlreadyExists` error.
|
||||
//
|
||||
// 2) If the server is back, we will be able to reconnect
|
||||
// successfully and receive the sidecar pkt in the next
|
||||
// iteration.
|
||||
//
|
||||
// 3) If the server is down, we won't be able to reconnect.
|
||||
_ = a.cfg.MailBox.InitSidecarMailbox(
|
||||
recipientStreamID, startingPkt.ReceiverTicket,
|
||||
)
|
||||
continue
|
||||
case <-a.quit:
|
||||
return
|
||||
|
|
@ -588,6 +605,21 @@ func (a *SidecarNegotiator) autoSidecarProvider(ctx context.Context,
|
|||
|
||||
select {
|
||||
case <-retryTimer.backOff(backoffLabel):
|
||||
// It is possible that we were not able to receive the
|
||||
// packet because the server went down. In that case,
|
||||
// we will try to init the sidecar mailbox again.
|
||||
// There is no need to log/check this error. There are
|
||||
// three possibilities:
|
||||
//
|
||||
// 1) If the error was not related with the sever being
|
||||
// down, we will get an `AlreadyExists` error.
|
||||
//
|
||||
// 2) If the server is back, we will be able to reconnect
|
||||
// successfully and receive the sidecar pkt in the next
|
||||
// iteration.
|
||||
//
|
||||
// 3) If the server is down, we won't be able to reconnect.
|
||||
_ = a.cfg.MailBox.InitAcctMailbox(streamID, acct.TraderKey)
|
||||
continue
|
||||
case <-a.quit:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue