2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-09-19 18:45:48 +08:00

Mux connections in parallel

This commit launches a go-routine for each accepted connection, to match
them in parallel.
This commit is contained in:
Soheil Hassas Yeganeh 2015-07-31 19:42:28 -04:00
parent fa65c0526e
commit 581432eab8

View File

@ -103,6 +103,11 @@ func (m *cMux) Serve() error {
continue
}
go m.serve(c)
}
}
func (m *cMux) serve(c net.Conn) {
muc := newMuxConn(c)
matched := false
outer:
@ -121,8 +126,7 @@ func (m *cMux) Serve() error {
c.Close()
err := ErrNotMatched{c: c}
if !m.handleErr(err) {
return err
}
m.root.Close()
}
}
}