public GenericOutcome Connect(Socket socketToAuxProxy, Network network)
        {
            sender = new AuxProxyMessageSender(socketToAuxProxy);
            var outcome = network.Connect();

            networkInitialized = outcome.Success;

            return(outcome);
        }
Esempio n. 2
0
        public GenericOutcome InitializeNetworking()
        {
            if (!networkInitialized)
            {
                lock (networkLock)
                {
                    // double-check to avoid race condition where we got here while we were already in the
                    // process of initializing
                    if (!networkInitialized)
                    {
                        var socketToAuxProxy   = IO.Socket(CreateURI(), CreateDefaultOptions());
                        var socketFromAuxProxy = IO.Socket(CreateURI(), CreateDefaultOptions());
                        sender  = new AuxProxyMessageSender(socketToAuxProxy);
                        network = new Network(socketToAuxProxy, socketFromAuxProxy, this);
                        var outcome = network.Connect();
                        networkInitialized = outcome.Success;
                        return(outcome);
                    }
                }
            }

            //Idempotent
            return(new GenericOutcome());
        }