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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 23 deletions

View File

@ -66,7 +66,7 @@ func generateFiles(dir string, files, maxexp int, srcname string) error {
}
func generateOneFile(fd io.ReadSeeker, p1 string, s int64) error {
src := io.LimitReader(&inifiteReader{fd}, s)
src := io.LimitReader(&infiniteReader{fd}, s)
dst, err := os.Create(p1)
if err != nil {
return err
@ -105,11 +105,11 @@ func readRand(bs []byte) (int, error) {
return len(bs), nil
}
type inifiteReader struct {
type infiniteReader struct {
rd io.ReadSeeker
}
func (i *inifiteReader) Read(bs []byte) (int, error) {
func (i *infiniteReader) Read(bs []byte) (int, error) {
n, err := i.rd.Read(bs)
if err == io.EOF {
err = nil

View File

@ -70,7 +70,7 @@ angular.module('syncthing.core')
});
// inform syncthingContoller that a modal is ready
// inform syncthingController that a modal is ready
scope.$parent.modalLoaded();
}
};

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],
},
} {

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)) {

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)
}
}
}

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")
)

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)

View File

@ -83,7 +83,7 @@ func generateFilesWithTime(dir string, files, maxexp int, srcname string, t0 tim
}
func generateOneFile(fd io.ReadSeeker, p1 string, s int64, t0 time.Time) error {
src := io.LimitReader(&inifiteReader{fd}, int64(s))
src := io.LimitReader(&infiniteReader{fd}, int64(s))
dst, err := os.Create(p1)
if err != nil {
return err
@ -265,11 +265,11 @@ func randomName() string {
return fmt.Sprintf("%x", b[:])
}
type inifiteReader struct {
type infiniteReader struct {
rd io.ReadSeeker
}
func (i *inifiteReader) Read(bs []byte) (int, error) {
func (i *infiniteReader) Read(bs []byte) (int, error) {
n, err := i.rd.Read(bs)
if err == io.EOF {
err = nil