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