mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-14 14:47:12 +00:00
Fix usage of Mutex
This commit is contained in:
1 parent
3fbae6795a
commit
bb442b4f83
4 files changed
+16
-16
No files matched your search
@@ -178,20 +178,20 @@ func (server *SocksServer) HandleConnection(connection net.Conn) error {
|
||||
readFinish.Lock()
|
||||
writeFinish.Lock()
|
||||
|
||||
go dumpInput(reader, input, readFinish)
|
||||
go dumpOutput(connection, output, writeFinish)
|
||||
go dumpInput(reader, input, &readFinish)
|
||||
go dumpOutput(connection, output, &writeFinish)
|
||||
writeFinish.Lock()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dumpInput(reader io.Reader, input chan<- []byte, finish sync.Mutex) {
|
||||
func dumpInput(reader io.Reader, input chan<- []byte, finish *sync.Mutex) {
|
||||
v2net.ReaderToChan(input, reader)
|
||||
finish.Unlock()
|
||||
close(input)
|
||||
}
|
||||
|
||||
func dumpOutput(writer io.Writer, output <-chan []byte, finish sync.Mutex) {
|
||||
func dumpOutput(writer io.Writer, output <-chan []byte, finish *sync.Mutex) {
|
||||
v2net.ChanToWriter(writer, output)
|
||||
finish.Unlock()
|
||||
}
|
||||
Reference in new issue
Block a user