This commit is contained in:
crusader 2018-04-13 19:43:14 +09:00
parent 5e42fbc185
commit adb8b71fd1

View File

@ -10,8 +10,7 @@ import (
func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-chan struct{}, doneChan chan<- error, readChan chan<- []byte) { func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-chan struct{}, doneChan chan<- error, readChan chan<- []byte) {
var ( var (
message []byte err error
err error
) )
defer func() { defer func() {
@ -37,6 +36,7 @@ func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-ch
}) })
for { for {
var message []byte
readMessageChan := make(chan struct{}) readMessageChan := make(chan struct{})
go func() { go func() {
@ -46,7 +46,6 @@ func connReadHandler(readWriteHandler ReadWriteHandler, conn Conn, stopChan <-ch
select { select {
case <-stopChan: case <-stopChan:
<-readMessageChan
return return
case <-readMessageChan: case <-readMessageChan:
} }