public static Task Activated(this ICallConnectionPool connectionPool, Func <ICallConnection> connectionFactory)
 {
     return(Task.Run(() =>
     {
         using var connection = connectionFactory();
         connection.WorkUntilDisconnect(connectionPool);
     }));
 }
 public WebListenerCallRegistry(ICallConnectionPool callConnectionPool, IEnumerable <string> prefixes)
     : base(callConnectionPool)
 {
     foreach (var prefix in prefixes)
     {
         _settings.UrlPrefixes.Add(prefix);
     }
 }
        public static async Task <byte[]> CallAsync(this ICallConnectionPool connectionPool, string ns, string method,
                                                    byte[] param)
        {
            var connection = connectionPool.FindByNamespace(ns);

            if (connection == null)
            {
                return(null);
            }

            return(await connection.CallAsync(method, param));
        }
Esempio n. 4
0
        public void WorkUntilDisconnect(ICallConnectionPool callConnectionPool)
        {
            callConnectionPool.Register(this);

            try
            {
                WorkUntilDisconnect().Wait();
            }
            catch
            {
                _socket.Abort();
            }
            finally
            {
                callConnectionPool.UnRegister(this);
            }
        }
 public void WorkUntilDisconnect(ICallConnectionPool callConnectionPool) => throw new NotImplementedException();
 public static byte[] Call(this ICallConnectionPool connectionPool, string ns, string method, byte[] param)
 {
     return(CallAsync(connectionPool, ns, method, param).Result);
 }
 public static async Task <byte[]> ProvideAvailableMethodsAsync(this ICallConnectionPool connectionPool, string ns)
 {
     return(await CallAsync(connectionPool, ns, string.Empty, new byte[0]));
 }
 protected CallRegistry(ICallConnectionPool callConnectionPool)
 {
     CallConnectionPool = callConnectionPool;
 }