Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct various typos #8870

Merged
merged 3 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/stgenfiles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gui/default/syncthing/core/modalDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand Down
6 changes: 3 additions & 3 deletions lib/connections/connections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestNextDialRegistryCleanup(t *testing.T) {
},
// Threshold reached, but outside of cooldown delay
{
attempts: dialCoolDownMaxAttemps,
attempts: dialCoolDownMaxAttempts,
coolDownIntervalStart: firsts[2],
},
} {
Expand All @@ -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],
},
} {
Expand Down
12 changes: 6 additions & 6 deletions lib/connections/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,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
Expand All @@ -1215,7 +1215,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
}
Expand All @@ -1226,7 +1226,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)
Expand Down Expand Up @@ -1254,7 +1254,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)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/fs/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/protocol/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
Expand Down
10 changes: 5 additions & 5 deletions lib/util/semaphore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down