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

Commit897a573

Browse files
authored
write.go: Fix deadlock in writeFrame (#253)
Closes#248Luckily, due to the 5s timeout on the close handshake, this would havehad very minimal effects on anyone in production.
1 parent493ebbe commit897a573

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎write.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ func (c *Conn) writeFrame(ctx context.Context, fin bool, flate bool, opcode opco
257257
iferr!=nil {
258258
return0,err
259259
}
260-
deferc.writeFrameMu.unlock()
261260

262261
// If the state says a close has already been written, we wait until
263262
// the connection is closed and return that error.
@@ -268,13 +267,15 @@ func (c *Conn) writeFrame(ctx context.Context, fin bool, flate bool, opcode opco
268267
wroteClose:=c.wroteClose
269268
c.closeMu.Unlock()
270269
ifwroteClose&&opcode!=opClose {
270+
c.writeFrameMu.unlock()
271271
select {
272272
case<-ctx.Done():
273273
return0,ctx.Err()
274274
case<-c.closed:
275275
return0,c.closeErr
276276
}
277277
}
278+
deferc.writeFrameMu.unlock()
278279

279280
select {
280281
case<-c.closed:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp