all: Correct various typos (#8870)

This commit is contained in:
Alexander Seiler
2023-05-09 08:54:02 +02:00
committed by GitHub
parent 66faea7712
commit ddce692f72
9 changed files with 23 additions and 23 deletions
+3 -3
View File
@@ -261,7 +261,7 @@ func TestNextDialRegistryCleanup(t *testing.T) {
},
// Threshold reached, but outside of cooldown delay
{
attempts: dialCoolDownMaxAttemps,
attempts: dialCoolDownMaxAttempts,
coolDownIntervalStart: firsts[2],
},
} {
@@ -281,11 +281,11 @@ func TestNextDialRegistryCleanup(t *testing.T) {
},
// attempts at threshold, inside delay
{
attempts: dialCoolDownMaxAttemps,
attempts: dialCoolDownMaxAttempts,
coolDownIntervalStart: firsts[0],
},
{
attempts: dialCoolDownMaxAttemps,
attempts: dialCoolDownMaxAttempts,
coolDownIntervalStart: firsts[1],
},
} {
+6 -6
View File
@@ -1196,9 +1196,9 @@ func (r nextDialRegistry) get(device protocol.DeviceID, addr string) time.Time {
}
const (
dialCoolDownInterval = 2 * time.Minute
dialCoolDownDelay = 5 * time.Minute
dialCoolDownMaxAttemps = 3
dialCoolDownInterval = 2 * time.Minute
dialCoolDownDelay = 5 * time.Minute
dialCoolDownMaxAttempts = 3
)
// redialDevice marks the device for immediate redial, unless the remote keeps
@@ -1217,7 +1217,7 @@ func (r nextDialRegistry) redialDevice(device protocol.DeviceID, now time.Time)
return
}
if dev.attempts == 0 || now.Before(dev.coolDownIntervalStart.Add(dialCoolDownInterval)) {
if dev.attempts >= dialCoolDownMaxAttemps {
if dev.attempts >= dialCoolDownMaxAttempts {
// Device has been force redialed too often - let it cool down.
return
}
@@ -1228,7 +1228,7 @@ func (r nextDialRegistry) redialDevice(device protocol.DeviceID, now time.Time)
dev.nextDial = make(map[string]time.Time)
return
}
if dev.attempts >= dialCoolDownMaxAttemps && now.Before(dev.coolDownIntervalStart.Add(dialCoolDownDelay)) {
if dev.attempts >= dialCoolDownMaxAttempts && now.Before(dev.coolDownIntervalStart.Add(dialCoolDownDelay)) {
return // Still cooling down
}
delete(r, device)
@@ -1256,7 +1256,7 @@ func (r nextDialRegistry) sleepDurationAndCleanup(now time.Time) time.Duration {
}
if dev.attempts > 0 {
interval := dialCoolDownInterval
if dev.attempts >= dialCoolDownMaxAttemps {
if dev.attempts >= dialCoolDownMaxAttempts {
interval = dialCoolDownDelay
}
if now.After(dev.coolDownIntervalStart.Add(interval)) {
+1 -1
View File
@@ -39,7 +39,7 @@ func TestIsInternal(t *testing.T) {
for _, tc := range cases {
res := IsInternal(filepath.FromSlash(tc.file))
if res != tc.internal {
t.Errorf("Unexpected result: IsInteral(%q): %v should be %v", tc.file, res, tc.internal)
t.Errorf("Unexpected result: IsInternal(%q): %v should be %v", tc.file, res, tc.internal)
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ var (
// ErrTooOldVersion is returned by ExchangeHello when the other side
// speaks an older, incompatible version of the protocol.
ErrTooOldVersion = errors.New("the remote device speaks an older version of the protocol not compatible with this version")
// ErrUnknownMagic is returned by ExchangeHellow when the other side
// ErrUnknownMagic is returned by ExchangeHello when the other side
// speaks something entirely unknown.
ErrUnknownMagic = errors.New("the remote device speaks an unknown (newer?) version of the protocol")
)
+5 -5
View File
@@ -8,7 +8,7 @@ package util
import "testing"
func TestZeroByteSempahore(_ *testing.T) {
func TestZeroByteSemaphore(_ *testing.T) {
// A semaphore with zero capacity is just a no-op.
s := NewSemaphore(0)
@@ -19,7 +19,7 @@ func TestZeroByteSempahore(_ *testing.T) {
s.Give(1 << 30)
}
func TestByteSempahoreCapChangeUp(t *testing.T) {
func TestByteSemaphoreCapChangeUp(t *testing.T) {
// Waiting takes should unblock when the capacity increases
s := NewSemaphore(100)
@@ -42,7 +42,7 @@ func TestByteSempahoreCapChangeUp(t *testing.T) {
}
}
func TestByteSempahoreCapChangeDown1(t *testing.T) {
func TestByteSemaphoreCapChangeDown1(t *testing.T) {
// Things should make sense when capacity is adjusted down
s := NewSemaphore(100)
@@ -63,7 +63,7 @@ func TestByteSempahoreCapChangeDown1(t *testing.T) {
}
}
func TestByteSempahoreCapChangeDown2(t *testing.T) {
func TestByteSemaphoreCapChangeDown2(t *testing.T) {
// Things should make sense when capacity is adjusted down, different case
s := NewSemaphore(100)
@@ -84,7 +84,7 @@ func TestByteSempahoreCapChangeDown2(t *testing.T) {
}
}
func TestByteSempahoreGiveMore(t *testing.T) {
func TestByteSemaphoreGiveMore(t *testing.T) {
// We shouldn't end up with more available than we have capacity...
s := NewSemaphore(100)