|
@@ -176,22 +176,20 @@ func (server *SocksServer) HandleConnection(connection net.Conn) error {
|
|
|
readFinish := make(chan bool)
|
|
readFinish := make(chan bool)
|
|
|
writeFinish := make(chan bool)
|
|
writeFinish := make(chan bool)
|
|
|
|
|
|
|
|
- go server.dumpInput(reader, input, readFinish)
|
|
|
|
|
- go server.dumpOutput(connection, output, writeFinish)
|
|
|
|
|
|
|
+ go dumpInput(reader, input, readFinish)
|
|
|
|
|
+ go dumpOutput(connection, output, writeFinish)
|
|
|
<-writeFinish
|
|
<-writeFinish
|
|
|
|
|
|
|
|
return nil
|
|
return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (server *SocksServer) dumpInput(reader io.Reader, input chan<- []byte, finish chan<- bool) {
|
|
|
|
|
|
|
+func dumpInput(reader io.Reader, input chan<- []byte, finish chan<- bool) {
|
|
|
v2net.ReaderToChan(input, reader)
|
|
v2net.ReaderToChan(input, reader)
|
|
|
close(input)
|
|
close(input)
|
|
|
- log.Debug("Socks input closed")
|
|
|
|
|
- finish <- true
|
|
|
|
|
|
|
+ close(finish)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (server *SocksServer) dumpOutput(writer io.Writer, output <-chan []byte, finish chan<- bool) {
|
|
|
|
|
|
|
+func dumpOutput(writer io.Writer, output <-chan []byte, finish chan<- bool) {
|
|
|
v2net.ChanToWriter(writer, output)
|
|
v2net.ChanToWriter(writer, output)
|
|
|
- log.Debug("Socks output closed")
|
|
|
|
|
- finish <- true
|
|
|
|
|
|
|
+ close(finish)
|
|
|
}
|
|
}
|