1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-09 04:29:17 -04:00

Move goroutine one level above.

This commit is contained in:
V2Ray
2015-10-10 01:25:12 +02:00
parent b115df56c0
commit 055c8f1833
3 changed files with 8 additions and 12 deletions

View File

@@ -46,14 +46,12 @@ func (vconn *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray core.Outb
go dumpOutput(conn, output, &readMutex, firstPacket.Destination().IsUDP())
go func() {
writeMutex.Lock()
if tcpConn, ok := conn.(*net.TCPConn); ok {
tcpConn.CloseWrite()
}
readMutex.Lock()
conn.Close()
}()
writeMutex.Lock()
if tcpConn, ok := conn.(*net.TCPConn); ok {
tcpConn.CloseWrite()
}
readMutex.Lock()
conn.Close()
return nil
}

View File

@@ -88,8 +88,7 @@ func (handler *VMessOutboundHandler) Dispatch(firstPacket v2net.Packet, ray core
request.RequestKey = buffer[16:32]
request.ResponseHeader = buffer[32:]
go startCommunicate(request, vNextAddress, ray, firstPacket)
return nil
return startCommunicate(request, vNextAddress, ray, firstPacket)
}
func startCommunicate(request *protocol.VMessRequest, dest v2net.Destination, ray core.OutboundRay, firstPacket v2net.Packet) error {