From 406360ed3efa9ea8090fc040c2f38ea8a8809a3a Mon Sep 17 00:00:00 2001 From: v2ray Date: Mon, 2 May 2016 23:02:40 +0200 Subject: [PATCH] fix test servers --- testing/servers/tcp/tcp.go | 1 - testing/servers/udp/udp.go | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/servers/tcp/tcp.go b/testing/servers/tcp/tcp.go index 42b9e1ea0..62852144c 100644 --- a/testing/servers/tcp/tcp.go +++ b/testing/servers/tcp/tcp.go @@ -32,7 +32,6 @@ func (server *Server) Start() (v2net.Destination, error) { func (server *Server) acceptConnections(listener *net.TCPListener) { server.accepting = true - defer listener.Close() for server.accepting { conn, err := listener.Accept() if err != nil { diff --git a/testing/servers/udp/udp.go b/testing/servers/udp/udp.go index 657d9e8c6..8cbf3bb99 100644 --- a/testing/servers/udp/udp.go +++ b/testing/servers/udp/udp.go @@ -31,8 +31,7 @@ func (server *Server) Start() (v2net.Destination, error) { func (server *Server) handleConnection(conn *net.UDPConn) { server.accepting = true - defer conn.Close() - for { + for server.accepting { buffer := make([]byte, 2*1024) nBytes, addr, err := conn.ReadFromUDP(buffer) if err != nil {