diff --git a/conn.go b/conn.go index 9793eff..0dd5090 100644 --- a/conn.go +++ b/conn.go @@ -27,6 +27,7 @@ type Conn struct { streamCount int closed bool isServer bool + running bool handler http.Handler lock *sync.Mutex err error @@ -227,6 +228,10 @@ func (c *Conn) Connect(addr string) (net.Conn, int, error) { // Run run the event loop func (c *Conn) Run() { + if c.running { + return + } + c.running = true defer c.Close() go c.readloop()