mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-06 08:02:21 +00:00
fix(imscore): retry REGISTER after backoff when an awaited EOF port-s stays missing
This commit is contained in:
1 parent
8b3f5ddc4d
commit
70549087fe
2 files changed
+17
-6
No files matched your search
+15
-5
@@ -60,11 +60,21 @@ func TestOtherPresetsRecoverPeerResetAfterPeerReconnect(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCarrierAwaitBacksOffWhenRegisterDoesNotRestorePortS(t *testing.T) {
|
||||
for _, observed := range []bool{false, true} {
|
||||
t.Run(map[bool]string{false: "first", true: "after-peer-reconnect"}[observed], func(t *testing.T) {
|
||||
service := newCarrierAwaitTestService(t, oneNZCarrierPresetID)
|
||||
service.portSOnDemandObserved.Store(observed)
|
||||
closeIdleTestPortS(t, service, syscall.ECONNRESET, 20*time.Minute)
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
preset string
|
||||
closeErr error
|
||||
observed bool
|
||||
}{
|
||||
{"one-nz/first", oneNZCarrierPresetID, syscall.ECONNRESET, false},
|
||||
{"one-nz/after-peer-reconnect", oneNZCarrierPresetID, syscall.ECONNRESET, true},
|
||||
{"globe-eof/first", globePHCarrierPresetID, io.EOF, false},
|
||||
{"dito-eof/first", ditoPHCarrierPresetID, io.EOF, false},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
service := newCarrierAwaitTestService(t, tc.preset)
|
||||
service.portSOnDemandObserved.Store(tc.observed)
|
||||
closeIdleTestPortS(t, service, tc.closeErr, 20*time.Minute)
|
||||
service.handleProtectedServerPushClosed()
|
||||
service.completePortSRecovery(nil, true)
|
||||
if !service.portSRecoveryAwaitingFlow.Load() {
|
||||
|
||||
@@ -464,7 +464,8 @@ func (s *Service) awaitPortSAfterRegister() bool {
|
||||
if s.portSRecoveryAwaitingFlow.Load() || s.portSMissingAfterRegister.Load() {
|
||||
return false
|
||||
}
|
||||
} else if s.portSRecoveryAwaitingFlow.Load() && !s.portSOnDemandObserved.Load() {
|
||||
} else if (s.portSRecoveryAwaitingFlow.Load() || s.portSMissingAfterRegister.Load()) &&
|
||||
!s.portSOnDemandObserved.Load() {
|
||||
return false
|
||||
}
|
||||
return s.canAwaitOnDemandPortS()
|
||||
|
||||
Reference in new issue
Block a user