Browse Source

Lazy initialize of socks5 response

V2Ray 10 years ago
parent
commit
8c5865d4e7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      proxy/socks/socks.go

+ 1 - 1
proxy/socks/socks.go

@@ -134,7 +134,6 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
 		return server.handleUDP(reader, writer)
 		return server.handleUDP(reader, writer)
 	}
 	}
 
 
-	response := protocol.NewSocks5Response()
 	if request.Command == protocol.CmdBind || request.Command == protocol.CmdUdpAssociate {
 	if request.Command == protocol.CmdBind || request.Command == protocol.CmdUdpAssociate {
 		response := protocol.NewSocks5Response()
 		response := protocol.NewSocks5Response()
 		response.Error = protocol.ErrorCommandNotSupported
 		response.Error = protocol.ErrorCommandNotSupported
@@ -151,6 +150,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
 		return UnsupportedSocksCommand
 		return UnsupportedSocksCommand
 	}
 	}
 
 
+  response := protocol.NewSocks5Response()
 	response.Error = protocol.ErrorSuccess
 	response.Error = protocol.ErrorSuccess
 
 
 	// Some SOCKS software requires a value other than dest. Let's fake one:
 	// Some SOCKS software requires a value other than dest. Let's fake one: