コード例 #1
0
        /// <summary>
        /// Instantiate the platform with no peers.  Be sure to StartServer() after, and then Add(Peer) peers.
        /// </summary>
        /// <param name="settings">Settings for the mesh network.</param>
        /// <param name="self">Local server configuration.</param>
        public WatsonMesh(MeshSettings settings, Peer self)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (self == null)
            {
                throw new ArgumentNullException(nameof(self));
            }

            _Settings = settings;
            _Self     = self;

            _PeerLock = new object();
            _Peers    = new List <Peer>();

            _ClientsLock = new object();
            _Clients     = new List <MeshClient>();

            _SyncRequests     = new ConcurrentDictionary <string, DateTime>();
            _PendingResponses = new ConcurrentDictionary <string, PendingResponse>();

            _Timer          = new Timer();
            _Timer.Elapsed += new ElapsedEventHandler(CleanupThread);
            _Timer.Interval = 5000;
            _Timer.Enabled  = true;
        }
コード例 #2
0
ファイル: MeshServer.cs プロジェクト: lulzzz/WatsonMesh
        /// <summary>
        /// Instantiate the object.
        /// </summary>
        /// <param name="settings">Settings.</param>
        /// <param name="self">Node details for the local node.</param>
        public MeshServer(MeshSettings settings, Peer self)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (self == null)
            {
                throw new ArgumentNullException(nameof(self));
            }

            _Settings = settings;
            _Self     = self;
        }
コード例 #3
0
ファイル: MeshClient.cs プロジェクト: lulzzz/WatsonMesh
        /// <summary>
        /// Instantiate the object.
        /// </summary>
        /// <param name="settings">Settings.</param>
        /// <param name="peer">Peer.</param>
        public MeshClient(MeshSettings settings, Peer peer)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (peer == null)
            {
                throw new ArgumentNullException(nameof(peer));
            }

            _Settings = settings;
            Peer      = peer;
        }