Example #1
0
    public override SessionPrx create(string name, Ice.Current current)
    {
        var session = new SessionI(name);
        var proxy   = SessionPrxHelper.uncheckedCast(current.adapter.addWithUUID(session));

        //
        // Remove endpoints to ensure that calls are collocated-only
        // This way, if we invoke on the proxy during shutdown, the invocation fails immediately
        // without attempting to establish any connection
        //
        var collocProxy = SessionPrxHelper.uncheckedCast(proxy.ice_endpoints(new Ice.Endpoint[0]));

        //
        // Never close this connection from the client and turn on heartbeats with a timeout of 30s
        //
        current.con.setACM(30, Ice.ACMClose.CloseOff, Ice.ACMHeartbeat.HeartbeatAlways);
        current.con.setCloseCallback(_ =>
        {
            try
            {
                collocProxy.destroy();
                Console.Out.WriteLine("Cleaned up dead client.");
            }
            catch (Ice.LocalException)
            {
                // The client already destroyed this session, or the server is shutting down
            }
        });
        return(proxy);
    }
Example #2
0
 public override SessionPrx create(string name, Ice.Current c)
 {
     SessionI session = new SessionI(name);
     SessionPrx proxy = SessionPrxHelper.uncheckedCast(c.adapter.addWithUUID(session));
     _reaper.add(proxy, session);
     return proxy;
 }
Example #3
0
 public void add(SessionPrx proxy, SessionI session)
 {
     lock (this)
     {
         _sessions.Add(new SessionProxyPair(proxy, session));
     }
 }
 public void add(SessionPrx proxy, SessionI session)
 {
     lock(this)
     {
         _sessions.Add(new SessionProxyPair(proxy, session));
     }
 }
Example #5
0
    public override SessionPrx create(string name, Ice.Current c)
    {
        var session = new SessionI(name);
        var proxy   = SessionPrxHelper.uncheckedCast(c.adapter.addWithUUID(session));

        _reaper.add(proxy, session);
        return(proxy);
    }
Example #6
0
        public static bool IsLegalIdentify(this SessionI session)
        {
            if (session is null)
            {
                return(false);
            }
            var identify = session.Get <string>("__identity__");

            if (System.String.IsNullOrEmpty(identify))
            {
                return(false);
            }

            return(true);
        }
Example #7
0
 public void add(SessionPrx proxy, SessionI session)
 {
     #if COMPACT
     _m.Lock();
     try
     {
         _sessions.Add(new SessionProxyPair(proxy, session));
     }
     finally
     {
         _m.Unlock();
     }
     #else
     lock(this)
     {
         _sessions.Add(new SessionProxyPair(proxy, session));
     }
     #endif
 }
Example #8
0
    public void add(SessionPrx proxy, SessionI session)
    {
#if COMPACT
        _m.Lock();
        try
        {
            _sessions.Add(new SessionProxyPair(proxy, session));
        }
        finally
        {
            _m.Unlock();
        }
#else
        lock (this)
        {
            _sessions.Add(new SessionProxyPair(proxy, session));
        }
#endif
    }
Example #9
0
 public SessionProxyPair(SessionPrx p, SessionI s)
 {
     proxy   = p;
     session = s;
 }
Example #10
0
 public SessionProxyPair(SessionPrx p, SessionI s)
 {
     proxy = p;
     session = s;
 }