ソースを参照

fix a race condition

Setting `closed` on the socket (which can mean either "the socket is broken"
or "we should close the socket at the next opportunity") was racing against
the final write. Even if socket.closed is true, we should attempt to send
buffered message data to the socket, before we send the `finalData` and
actually call `Close`.
tags/v1.1.0-rc1
Shivaram Lingamneni 5年前
コミット
0af0a0b445
1個のファイルの変更1行の追加1行の削除
  1. 1
    1
      irc/socket.go

+ 1
- 1
irc/socket.go ファイルの表示

@@ -254,7 +254,7 @@ func (socket *Socket) performWrite() (closed bool) {
254 254
 	socket.Unlock()
255 255
 
256 256
 	var err error
257
-	if !closed && len(buffers) > 0 {
257
+	if 0 < len(buffers) {
258 258
 		// on Linux, the runtime will optimize this into a single writev(2) call:
259 259
 		_, err = (*net.Buffers)(&buffers).WriteTo(socket.conn)
260 260
 	}

読み込み中…
キャンセル
保存