Move goroutine one level above.

pull/40/head
V2Ray 9 years ago
parent b115df56c0
commit 055c8f1833

@ -97,7 +97,6 @@ func (vp *Point) Start() error {
func (p *Point) DispatchToOutbound(packet v2net.Packet) InboundRay { func (p *Point) DispatchToOutbound(packet v2net.Packet) InboundRay {
ray := NewRay() ray := NewRay()
// TODO: handle error go p.och.Dispatch(packet, ray)
p.och.Dispatch(packet, ray)
return ray return ray
} }

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

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

Loading…
Cancel
Save