Skip to content

Commit 3f4178d

Browse files
committed
chore: fix typo and syntax error
1 parent c5cc5c2 commit 3f4178d

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We use [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) as o
1414
We are using [Github Issues](https://github.com/cloudwego/netpoll/issues) for our public bugs. We keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn’t already exist.
1515

1616
### 2. Reporting New Issues
17-
Providing a reduced test code is a recommended way for reporting issues. Then can placed in:
17+
Providing a reduced test code is a recommended way for reporting issues. Then can be placed in:
1818
- Just in issues
1919
- [Golang Playground](https://play.golang.org/)
2020

@@ -45,9 +45,9 @@ Before you submit your Pull Request (PR) consider the following guidelines:
4545
4646
## Contribution Prerequisites
4747
- Our development environment keeps up with [Go Official](https://golang.org/project/).
48-
- You need fully checking with lint tools before submit your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) and [golangci-lint](https://github.com/golangci/golangci-lint)
48+
- You need to fully check with lint tools before submitting your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) and [golangci-lint](https://github.com/golangci/golangci-lint)
4949
- You are familiar with [Github](https://github.com)
50-
- Maybe you need familiar with [Actions](https://github.com/features/actions)(our default workflow tool).
50+
- Maybe you need to be familiar with [Actions](https://github.com/features/actions)(our default workflow tool).
5151
5252
## Code Style Guides
5353
- [Effective Go](https://golang.org/doc/effective_go)

connection_errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
// The connection closed when in use.
2626
ErrConnClosed = syscall.Errno(0x101)
27-
// Read I/O buffer timeout, calling by Connection.Reader
27+
// Read I/O buffer timeout, called by Connection.Reader
2828
ErrReadTimeout = syscall.Errno(0x102)
2929
// Dial timeout
3030
ErrDialTimeout = syscall.Errno(0x103)

connection_impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
connStateDisconnected = 2
3333
)
3434

35-
// connection is the implement of Connection
35+
// connection is the implementation of Connection
3636
type connection struct {
3737
netFD
3838
onEvent

connection_lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const (
5353
)
5454

5555
type locker struct {
56-
// keychain use for lock/unlock/stop operation by who.
56+
// keychain used for lock/unlock/stop operation by who.
5757
// 0 means unlock, 1 means locked, 2 means stop.
5858
keychain [total]int32
5959
}

connection_onevent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func (c *connection) onProcess(onConnect OnConnect, onRequest OnRequest) (proces
231231
if closedBy != none {
232232
// if closed by user when processing, it "may" needs detach
233233
needDetach := closedBy == user
234-
// Here is a conor case that operator will be detached twice:
234+
// Here is a corner case that operator will be detached twice:
235235
// If server closed the connection(client OnHup will detach op first and closeBy=poller),
236236
// and then client's OnRequest function also closed the connection(closeBy=user).
237237
// But operator already prevent that detach twice will not cause any problem
@@ -240,7 +240,7 @@ func (c *connection) onProcess(onConnect OnConnect, onRequest OnRequest) (proces
240240
return
241241
}
242242
c.unlock(processing)
243-
// Note: Poller's closeCallback call will try to get processing lock failed but here already neer to unlock processing.
243+
// Note: Poller's closeCallback call will try to get processing lock failed but here already near to unlock processing.
244244
// So here we need to check connection state again, to avoid connection leak
245245
// double check close state
246246
if c.status(closing) != 0 && c.lock(processing) {

net_dialer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ func DialConnection(network, address string, timeout time.Duration) (connection
2828
return defaultDialer.DialConnection(network, address, timeout)
2929
}
3030

31-
// NewFDConnection create a Connection initialed by any fd
32-
// It's useful for write unit test for functions have args with the type of netpoll.Connection
33-
// The typical usage like:
31+
// NewFDConnection create a Connection initialized by any fd
32+
// It's useful for writing unit tests for functions that have args with the type of netpoll.Connection
33+
// The typical usage is like:
3434
//
3535
// rfd, wfd := netpoll.GetSysFdPairs()
3636
// rconn, _ = netpoll.NewFDConnection(rfd)

nocopy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const (
265265
// which indicate that the buffer node memory is not controlled by itself,
266266
// so we cannot reuse the buffer or nocopy read it.
267267
readonlyMask uint8 = 1 << 0 // 0000 0001
268-
// readonlyMask is used to set nocopyRead mode,
268+
// nocopyReadMask is used to set nocopyRead mode,
269269
// which indicate that the buffer node has been no copy read and cannot reuse the buffer.
270270
nocopyReadMask uint8 = 1 << 1 // 0000 0010
271271
)

nocopy_linkbuffer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func (b *UnsafeLinkBuffer) readBinary(n int) (p []byte) {
256256
// single node
257257
if b.isSingleNode(n) {
258258
// TODO: enable nocopy read mode when ensure no legacy depend on copy-read
259-
// we cannot nocopy read a readonly mode buffer, since readonly buffer's memory is not control by itself
259+
// we cannot nocopy read a readonly mode buffer, since readonly buffer's memory is not controlled by itself
260260
if !b.read.getMode(readonlyMask) {
261261
// if readBinary use no-copy mode, it will cause more memory used but get higher memory access efficiently
262262
// for example, if user's codec need to decode 10 strings and each have 100 bytes, here could help the codec
@@ -798,7 +798,7 @@ func newLinkBufferNode(size int) *linkBufferNode {
798798
var linkedPool = sync.Pool{
799799
New: func() interface{} {
800800
return &linkBufferNode{
801-
refer: 1, // 自带 1 引用
801+
refer: 1, // comes with 1 reference
802802
}
803803
},
804804
}

poll_default_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (p *defaultPoll) handler(events []epollevent) (closed bool) {
173173
var leftRead int
174174
// read all left data if peer send and close
175175
if leftRead, err = readall(operator, p.barriers[i]); err != nil && !errors.Is(err, ErrEOF) {
176-
logger.Printf("NETPOLL: readall(fd=%d)=%d before close: %s", operator.FD, total, err.Error())
176+
logger.Printf("NETPOLL: readall(fd=%d)=%d before close: %s", operator.FD, totalRead, err.Error())
177177
}
178178
totalRead += leftRead
179179
}

0 commit comments

Comments
 (0)