mirror of
https://github.com/SagerNet/sing-shadowsocks.git
synced 2025-04-03 03:47:40 +03:00
Fix close conn
This commit is contained in:
parent
484a11603b
commit
7cbd7d6346
4 changed files with 31 additions and 13 deletions
25
Makefile
Normal file
25
Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
.PHONY: test
|
||||
|
||||
fmt:
|
||||
@gofumpt -l -w .
|
||||
@gofmt -s -w .
|
||||
@gci write -s "standard,prefix(github.com/sagernet/),default" .
|
||||
|
||||
fmt_install:
|
||||
go install -v mvdan.cc/gofumpt@latest
|
||||
go install -v github.com/daixiang0/gci@v0.4.0
|
||||
|
||||
lint:
|
||||
GOOS=linux golangci-lint run ./...
|
||||
GOOS=windows golangci-lint run ./...
|
||||
GOOS=darwin golangci-lint run ./...
|
||||
GOOS=freebsd golangci-lint run ./...
|
||||
|
||||
lint_install:
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
|
||||
test:
|
||||
@go test -v . && \
|
||||
pushd test && \
|
||||
go test -v . && \
|
||||
popd
|
|
@ -1,7 +0,0 @@
|
|||
package shadowsocks
|
||||
|
||||
//go:generate go install -v mvdan.cc/gofumpt@latest
|
||||
//go:generate go install -v github.com/daixiang0/gci@v0.4.0
|
||||
//go:generate gofumpt -l -w .
|
||||
//go:generate gofmt -s -w .
|
||||
//go:generate gci write -s "standard,prefix(github.com/sagernet/),default" .
|
|
@ -222,7 +222,7 @@ type clientConn struct {
|
|||
net.Conn
|
||||
destination M.Socksaddr
|
||||
requestSalt []byte
|
||||
reader io.Reader
|
||||
reader *shadowaead.Reader
|
||||
writer *shadowaead.Writer
|
||||
}
|
||||
|
||||
|
@ -485,8 +485,8 @@ func (c *clientConn) Upstream() any {
|
|||
func (c *clientConn) Close() error {
|
||||
return common.Close(
|
||||
c.Conn,
|
||||
c.reader,
|
||||
c.writer,
|
||||
common.PtrOrNil(c.reader),
|
||||
common.PtrOrNil(c.writer),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ type serverConn struct {
|
|||
uPSK []byte
|
||||
access sync.Mutex
|
||||
headerType byte
|
||||
reader io.Reader
|
||||
reader *shadowaead.Reader
|
||||
writer *shadowaead.Writer
|
||||
requestSalt []byte
|
||||
}
|
||||
|
@ -369,8 +369,8 @@ func (c *serverConn) WriteTo(w io.Writer) (n int64, err error) {
|
|||
func (c *serverConn) Close() error {
|
||||
return common.Close(
|
||||
c.Conn,
|
||||
c.reader,
|
||||
c.writer,
|
||||
common.PtrOrNil(c.reader),
|
||||
common.PtrOrNil(c.writer),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue