func newClient(conn net.Conn, pumperInN, pumperOutN int) *client { c := &client{} mux := bdmsg.NewPumpMux(nil) mux.HandleFunc(MsgTypeConnectReply, c.handleConnectReply) c.Client = bdmsg.NewClient(nil, conn, bdmsg.DefaultIOC, mux, pumperInN, pumperOutN) c.doConnect() return c }
func newService(l net.Listener, handshakeTO time.Duration, pumperInN, pumperOutN int) *server { s := &server{} mux := bdmsg.NewPumpMux(nil) mux.HandleFunc(MsgTypeConnect, s.handleConnect) s.Server = bdmsg.NewServerF(l, bdmsg.DefaultIOC, handshakeTO, mux, pumperInN, pumperOutN) return s }