Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd07a64

Browse files
committed
Merge branch 'dev'
2 parentse3a2d32 +e87d61a commitbd07a64

31 files changed

+868
-331
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on:ubuntu-latest
1010
steps:
1111
-uses:actions/checkout@v4
12-
-uses:actions/setup-go@v4
12+
-uses:actions/setup-go@v5
1313
with:
1414
go-version-file:./go.mod
1515
-run:./ci/fmt.sh
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
-uses:actions/checkout@v4
2121
-run:go version
22-
-uses:actions/setup-go@v4
22+
-uses:actions/setup-go@v5
2323
with:
2424
go-version-file:./go.mod
2525
-run:./ci/lint.sh
@@ -28,7 +28,7 @@ jobs:
2828
runs-on:ubuntu-latest
2929
steps:
3030
-uses:actions/checkout@v4
31-
-uses:actions/setup-go@v4
31+
-uses:actions/setup-go@v5
3232
with:
3333
go-version-file:./go.mod
3434
-run:./ci/test.sh
@@ -41,7 +41,7 @@ jobs:
4141
runs-on:ubuntu-latest
4242
steps:
4343
-uses:actions/checkout@v4
44-
-uses:actions/setup-go@v4
44+
-uses:actions/setup-go@v5
4545
with:
4646
go-version-file:./go.mod
4747
-run:./ci/bench.sh

‎.github/workflows/daily.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on:ubuntu-latest
1313
steps:
1414
-uses:actions/checkout@v4
15-
-uses:actions/setup-go@v4
15+
-uses:actions/setup-go@v5
1616
with:
1717
go-version-file:./go.mod
1818
-run:AUTOBAHN=1 ./ci/bench.sh
1919
test:
2020
runs-on:ubuntu-latest
2121
steps:
2222
-uses:actions/checkout@v4
23-
-uses:actions/setup-go@v4
23+
-uses:actions/setup-go@v5
2424
with:
2525
go-version-file:./go.mod
2626
-run:AUTOBAHN=1 ./ci/test.sh
@@ -34,7 +34,7 @@ jobs:
3434
-uses:actions/checkout@v4
3535
with:
3636
ref:dev
37-
-uses:actions/setup-go@v4
37+
-uses:actions/setup-go@v5
3838
with:
3939
go-version-file:./go.mod
4040
-run:AUTOBAHN=1 ./ci/bench.sh
@@ -44,11 +44,11 @@ jobs:
4444
-uses:actions/checkout@v4
4545
with:
4646
ref:dev
47-
-uses:actions/setup-go@v4
47+
-uses:actions/setup-go@v5
4848
with:
4949
go-version-file:./go.mod
5050
-run:AUTOBAHN=1 ./ci/test.sh
5151
-uses:actions/upload-artifact@v3
5252
with:
53-
name:coverage.html
53+
name:coverage-dev.html
5454
path:./ci/out/coverage.html

‎accept_test.go‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net/http"
1111
"net/http/httptest"
1212
"strings"
13+
"sync"
1314
"testing"
1415

1516
"nhooyr.io/websocket/internal/test/assert"
@@ -142,6 +143,42 @@ func TestAccept(t *testing.T) {
142143
_,err:=Accept(w,r,nil)
143144
assert.Contains(t,err,`failed to hijack connection`)
144145
})
146+
t.Run("closeRace",func(t*testing.T) {
147+
t.Parallel()
148+
149+
server,_:=net.Pipe()
150+
151+
rw:=bufio.NewReadWriter(bufio.NewReader(server),bufio.NewWriter(server))
152+
newResponseWriter:=func() http.ResponseWriter {
153+
returnmockHijacker{
154+
ResponseWriter:httptest.NewRecorder(),
155+
hijack:func() (net.Conn,*bufio.ReadWriter,error) {
156+
returnserver,rw,nil
157+
},
158+
}
159+
}
160+
w:=newResponseWriter()
161+
162+
r:=httptest.NewRequest("GET","/",nil)
163+
r.Header.Set("Connection","Upgrade")
164+
r.Header.Set("Upgrade","websocket")
165+
r.Header.Set("Sec-WebSocket-Version","13")
166+
r.Header.Set("Sec-WebSocket-Key",xrand.Base64(16))
167+
168+
c,err:=Accept(w,r,nil)
169+
wg:=&sync.WaitGroup{}
170+
wg.Add(2)
171+
gofunc() {
172+
c.Close(StatusInternalError,"the sky is falling")
173+
wg.Done()
174+
}()
175+
gofunc() {
176+
c.CloseNow()
177+
wg.Done()
178+
}()
179+
wg.Wait()
180+
assert.Success(t,err)
181+
})
145182
}
146183

147184
funcTest_verifyClientHandshake(t*testing.T) {

‎ci/bench.sh‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22
set -eu
33
cd --"$(dirname"$0")/.."
44

5-
gotest --run=^$ --bench=. --benchmem --memprofile ci/out/prof.mem --cpuprofile ci/out/prof.cpu -o ci/out/websocket.test"$@".
5+
gotest --run=^$ --bench=. --benchmem"$@" ./...
6+
# For profiling add: --memprofile ci/out/prof.mem --cpuprofile ci/out/prof.cpu -o ci/out/websocket.test
67
(
78
cd ./internal/thirdparty
8-
gotest --run=^$ --bench=. --benchmem --memprofile ../../ci/out/prof-thirdparty.mem --cpuprofile ../../ci/out/prof-thirdparty.cpu -o ../../ci/out/thirdparty.test"$@".
9+
gotest --run=^$ --bench=. --benchmem"$@".
10+
11+
GOARCH=arm64 gotest -c -o ../../ci/out/thirdparty-arm64.test"$@".
12+
if ["$#"-eq 0 ];then
13+
if ["${CI-}" ];then
14+
sudo apt-get update
15+
sudo apt-get install -y qemu-user-static
16+
ln -s /usr/bin/qemu-aarch64-static /usr/local/bin/qemu-aarch64
17+
fi
18+
qemu-aarch64 ../../ci/out/thirdparty-arm64.test --test.run=^$ --test.bench=Benchmark_mask --test.benchmem
19+
fi
920
)

‎ci/fmt.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ npx prettier@3.0.3 \
1818
$(git ls-files"*.yml""*.md""*.js""*.css""*.html")
1919

2020
go run golang.org/x/tools/cmd/stringer@latest -type=opcode,MessageType,StatusCode -output=stringer.go
21+
22+
if ["${CI-}" ];then
23+
git diff --exit-code
24+
fi

‎ci/test.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ cd -- "$(dirname "$0")/.."
1111
gotest"$@" ./...
1212
)
1313

14+
(
15+
GOARCH=arm64 gotest -c -o ./ci/out/websocket-arm64.test"$@".
16+
if ["$#"-eq 0 ];then
17+
if ["${CI-}" ];then
18+
sudo apt-get update
19+
sudo apt-get install -y qemu-user-static
20+
ln -s /usr/bin/qemu-aarch64-static /usr/local/bin/qemu-aarch64
21+
fi
22+
qemu-aarch64 ./ci/out/websocket-arm64.test -test.run=TestMask
23+
fi
24+
)
25+
26+
1427
go install github.com/agnivade/wasmbrowsertest@latest
1528
gotest --race --bench=. --timeout=1h --covermode=atomic --coverprofile=ci/out/coverage.prof --coverpkg=./..."$@" ./...
1629
sed -i.bak'/stringer\.go/d' ci/out/coverage.prof

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp