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

Commit69f55f3

Browse files
bhallionOhbibinhooyr
authored andcommitted
read.go: Avoid handling ping after close frame has been sent
Closes#298
1 parentc537145 commit69f55f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎read.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ func (c *Conn) handleControl(ctx context.Context, h header) (err error) {
286286

287287
switchh.opcode {
288288
caseopPing:
289+
c.closeMu.Lock()
290+
wroteClose:=c.wroteClose
291+
c.closeMu.Unlock()
292+
ifwroteClose {
293+
// Cannot respond to ping with a pong because we already sent a close frame.
294+
returnnil
295+
}
289296
returnc.writeControl(ctx,opPong,b)
290297
caseopPong:
291298
c.activePingsMu.Lock()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp