mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-03 01:38:24 -04:00
format code
This commit is contained in:
parent
790db40821
commit
b000850370
@ -81,14 +81,14 @@ func (handler *VMessInboundHandler) HandleConnection(connection net.Conn) error
|
||||
// Optimize for small response packet
|
||||
buffer := make([]byte, 0, 1024)
|
||||
buffer = append(buffer, response[:]...)
|
||||
|
||||
|
||||
if data, open := <-output; open {
|
||||
buffer = append(buffer, data...)
|
||||
responseWriter.Write(buffer)
|
||||
go handleOutput(request, responseWriter, output, writeFinish)
|
||||
<-writeFinish
|
||||
responseWriter.Write(buffer)
|
||||
go handleOutput(request, responseWriter, output, writeFinish)
|
||||
<-writeFinish
|
||||
}
|
||||
|
||||
|
||||
if tcpConn, ok := connection.(*net.TCPConn); ok {
|
||||
log.Debug("VMessIn closing write")
|
||||
tcpConn.CloseWrite()
|
||||
|
@ -109,18 +109,18 @@ func handleRequest(conn *net.TCPConn, request *vmessio.VMessRequest, input <-cha
|
||||
log.Error("VMessOut: Failed to serialize VMess request: %v", err)
|
||||
}
|
||||
|
||||
// Send first packet of payload together with request, in favor of small requests.
|
||||
// Send first packet of payload together with request, in favor of small requests.
|
||||
payload, open := <-input
|
||||
if open {
|
||||
encryptRequestWriter.Crypt(payload)
|
||||
buffer = append(buffer, payload...)
|
||||
|
||||
_, err = conn.Write(buffer)
|
||||
if err != nil {
|
||||
log.Error("VMessOut: Failed to write VMess request: %v", err)
|
||||
}
|
||||
|
||||
v2net.ChanToWriter(encryptRequestWriter, input)
|
||||
|
||||
_, err = conn.Write(buffer)
|
||||
if err != nil {
|
||||
log.Error("VMessOut: Failed to write VMess request: %v", err)
|
||||
}
|
||||
|
||||
v2net.ChanToWriter(encryptRequestWriter, input)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user