Ejemplo n.º 1
0
        private void OnSoftDisconnectWriter()
        {
            Log.EntryNormal(LogW, "Writer soft disconnect");
            //Log.Console(info.remote + " writer softly disconnected");

            Queue <SocketWriterMessage> msgs = writer.ExtractAllMessages();

            writer       = null;
            writerStatus = WriteStatus.READY;

            while (msgs.Any() && msgs.Peek().type == SocketWriterMessageType.SOFT_DISCONNECT)
            {
                msgs.Dequeue();
            }

            if (msgs.Any())
            {
                ConnectAsync();

                while (msgs.Any())
                {
                    writer.SendMessage(msgs.Dequeue());
                }
            }
        }
Ejemplo n.º 2
0
        private void OnSoftDisconnectReader()
        {
            Log.EntryNormal(LogR, "Reader soft disconnect");
            //Log.Console(info.remote + " reader softly disconnected");

            reader       = null;
            readerStatus = ReadStatus.READY;

            //SoftDisconnect();
        }
Ejemplo n.º 3
0
        public void Close()
        {
            Log.EntryNormal(log, "Closing all");

            foreach (var h in hosts.Values)
            {
                h.Close();
            }

            sl.TerminateThread();
        }
Ejemplo n.º 4
0
 private void NewIncomingConnection(Handshake info, Socket sck)
 {
     Log.EntryNormal(log, "New connection: " + info);
     MyAssert.Assert(hosts.ContainsKey(info.local.hostname));
     hosts.GetValue(info.local.hostname).NewIncomingConnection(info, sck);
 }