Make connection multiplexing configurable

This commit is contained in:
9seconds
2019-11-11 15:03:59 +03:00
parent 34ad883559
commit a7a4da8ee5
3 changed files with 19 additions and 3 deletions
+3 -3
View File
@@ -3,9 +3,9 @@ package hub
import (
"fmt"
"sort"
)
const connectionListMaxClientsPerConnection = 2
"github.com/9seconds/mtg/config"
)
type connectionList struct {
connections []*connection
@@ -16,7 +16,7 @@ func (c *connectionList) Get(conn *ProxyConn) (*connection, error) {
c.gc()
}
if len(c.connections) > 0 && c.connections[0].Len() < connectionListMaxClientsPerConnection {
if len(c.connections) > 0 && c.connections[0].Len() < config.C.MultiplexPerConnection {
if err := c.connections[0].Attach(conn); err == nil {
return c.connections[0], nil
}