Esempio n. 1
0
        public static async Task <TgBellhop> Connect(
            ConnectInfo connectInfo,
            TgCallMiddlewareChain?callMiddlewareChain = null,
            TcpClientConnectionHandler?connHandler    = null
            )
        {
            callMiddlewareChain ??= TgCallMiddlewareChain.Default;
            var conn = await TaskWrapper.Wrap(() =>
                                              TgConnectionEstablisher.EstablishConnection(connectInfo, callMiddlewareChain, connHandler)
                                              ).ConfigureAwait(false);

            var pool = new TgConnectionPool(conn, callMiddlewareChain, connHandler);

            return(new TgBellhop(pool, conn));
        }
Esempio n. 2
0
 public TgBellhop(Some <TgConnectionPool> connectionPool, Some <TgConnection> currentConnection)
 {
     ConnectionPool    = connectionPool;
     CurrentConnection = currentConnection.Value.AsVar();
     MirrorUpdates(currentConnection);
 }