Exemplo n.º 1
0
        public GlobalHost(ActionSyncronizerProxy processQueue_, IPAddress myIP, TimerThread tt)
        {
            this.myIP    = myIP;
            this.tt      = tt;
            processQueue = processQueue_;
            log          = MasterLog.GetFileLog("network", "globalhost.log");

            StartListening();
        }
Exemplo n.º 2
0
        public SocketWriter(IPEndPoint address, ActionSyncronizerProxy sync,
                            Action <Exception, DisconnectType> errorResponse, Action onSoftDisconnect,
                            Handshake info)
        {
            this.address = address;
            this.info    = info;

            this.errorResponse    = sync.Convert(errorResponse);
            this.onSoftDisconnect = sync.Convert(onSoftDisconnect);

            ThreadManager.NewThread(WritingThread, TerminateThread,
                                    "SocketWriter " + address);
        }
Exemplo n.º 3
0
        //Action<Exception> onHandshakeError;

        public SocketListener(ActionSyncronizerProxy sync, Action <Handshake, Socket> processConnection, Socket sckListen)
        {
            using (var h = DisposeHandle.Get(sckListen))
            {
                this.sckListen         = sckListen;
                this.processConnection = sync.Convert(processConnection);
                //this.onHandshakeError = onHandshakeError;

                ThreadManager.NewThread(() => ProcessThread(),
                                        () => TerminateThread(), "SocketListener " + NetTools.GetLocalIP(sckListen).ToString());

                h.Disengage();
            }
        }
Exemplo n.º 4
0
        public OverlayHost(OverlayHostName hostName, IPEndPoint address, ActionSyncronizerProxy processQueue,
                           ProcessorAssigner messageProcessorAssigner, MemoryStream extraHandshakeInfo,
                           TimerThread tt, TimeSpan inactivityPeriod)
        {
            this.inactivityPeriod  = inactivityPeriod;
            this.hostName          = hostName;
            this.IpAddress         = address;
            this.processQueue      = processQueue;
            this.processorAssigner = messageProcessorAssigner;

            this.extraHandshakeInfo = extraHandshakeInfo;

            log = MasterLog.GetFileLog("network", hostName.ToString() + ".log");

            tt.AddAction(this.DisconnectInactiveNodes);
        }
Exemplo n.º 5
0
        public SocketReader(ActionSyncronizerProxy sync,
                            Action <MemoryStream> messageProcessor, Action <IOException> errorResponse, Action onSoftDisconnect,
                            Socket socketRead)
        {
            using (var h = DisposeHandle.Get(socketRead))
            {
                this.onSoftDisconnect = sync.Convert(onSoftDisconnect);
                this.messageProcessor = sync.Convert(messageProcessor);
                this.errorResponse    = sync.Convert(errorResponse);

                this.socketRead = socketRead;

                ThreadManager.NewThread(() => this.ProcessThread(),
                                        () => TerminateThread(), "SocketReader " + NetTools.GetRemoteIP(socketRead).ToString());
                h.Disengage();
            }
        }
Exemplo n.º 6
0
        public Node(Handshake info_, ActionSyncronizerProxy actionQueue_, DisconnectProcessor processDisonnect_)
        {
            info            = info_;
            sync            = actionQueue_;
            notifyDisonnect = processDisonnect_;

            writerStatus = WriteStatus.READY;
            readerStatus = ReadStatus.READY;
            IsClosed     = false;

            if (MasterLog.LogLevel > 1)
            {
                LogR = MasterLog.GetFileLog("network", info.local.hostname.ToString(),
                                            info.remote.ToString().Replace(':', '.') + " read.xml");

                LogW = MasterLog.GetFileLog("network", info.local.hostname.ToString(),
                                            info.remote.ToString().Replace(':', '.') + " write.xml");
            }

            UpdateUseTime();
        }