1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05:00

clean up variable initialization

This commit is contained in:
v2ray 2016-02-03 21:36:52 +01:00
parent edd02f7d3c
commit c6df0fde19
4 changed files with 4 additions and 7 deletions

View File

@ -59,8 +59,7 @@ func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.Outbou
defer readMutex.Unlock() defer readMutex.Unlock()
defer close(output) defer close(output)
var reader io.Reader var reader io.Reader = conn
reader = conn
if firstPacket.Destination().IsUDP() { if firstPacket.Destination().IsUDP() {
reader = v2net.NewTimeOutReader(16 /* seconds */, conn) reader = v2net.NewTimeOutReader(16 /* seconds */, conn)

View File

@ -9,7 +9,7 @@ import (
) )
func TestHopByHopHeadersStrip(t *testing.T) { func TestHopByHopHeadersStrip(t *testing.T) {
var rawRequest = `GET /pkg/net/http/ HTTP/1.1 rawRequest := `GET /pkg/net/http/ HTTP/1.1
Host: golang.org Host: golang.org
Connection: keep-alive,Foo, Bar Connection: keep-alive,Foo, Bar
Foo: foo Foo: foo

View File

@ -127,8 +127,7 @@ func (this *VMessInboundHandler) HandleConnection(connection *hub.TCPConn) {
data.Release() data.Release()
responseWriter.Write(buffer.Value) responseWriter.Write(buffer.Value)
go func(finish *sync.Mutex) { go func(finish *sync.Mutex) {
var writer v2io.Writer var writer v2io.Writer = v2io.NewAdaptiveWriter(responseWriter)
writer = v2io.NewAdaptiveWriter(responseWriter)
if request.IsChunkStream() { if request.IsChunkStream() {
writer = vmessio.NewAuthChunkWriter(writer) writer = vmessio.NewAuthChunkWriter(writer)
} }

View File

@ -140,8 +140,7 @@ func (this *VMessOutboundHandler) handleRequest(conn net.Conn, request *protocol
} }
if moreChunks { if moreChunks {
var streamWriter v2io.Writer var streamWriter v2io.Writer = v2io.NewAdaptiveWriter(encryptRequestWriter)
streamWriter = v2io.NewAdaptiveWriter(encryptRequestWriter)
if request.IsChunkStream() { if request.IsChunkStream() {
streamWriter = vmessio.NewAuthChunkWriter(streamWriter) streamWriter = vmessio.NewAuthChunkWriter(streamWriter)
} }