public PortListenerState() { this.dateTime_0 = DateTime.Now; this.bool_0 = true; this.bool_1 = true; this.bool_2 = false; this.bool_3 = true; this.listenerSubState_0 = ListenerSubState.IdleSleep; }
public PortListenerState(DateTime last, bool listen, bool authorized, bool connFull, bool running, ListenerSubState sub) { this.dateTime_0 = DateTime.Now; this.bool_0 = true; this.bool_1 = true; this.bool_2 = false; this.bool_3 = true; this.listenerSubState_0 = ListenerSubState.IdleSleep; this.dateTime_0 = last; this.bool_0 = listen; this.bool_1 = authorized; this.bool_2 = connFull; this.bool_3 = running; this.listenerSubState_0 = sub; }
protected override bool DoDetect() { try { this.dateTime_0 = DateTime.Now; bool flag = true; if (!this.bool_1) { flag = this.class117_0.method_0() && (this.interface20_0.imethod_40() < this.int_0); } if (!flag) { if (this.object_0 != 0) { this.object_0 = 0; this.tcpListener_0.Stop(); if (this.tcpListener_1 != null) { this.tcpListener_1.Stop(); } } Thread.Sleep(this.int_4); return(true); } if (this.object_0 == null) { this.tcpListener_0.Start(); if (this.tcpListener_1 != null) { this.tcpListener_1.Start(); } this.object_0 = 1; } Socket socket = null; this.listenerSubState_0 = ListenerSubState.ExcutePending; if (this.tcpListener_0.Pending()) { this.listenerSubState_0 = ListenerSubState.ExcuteAcceptSocket; socket = this.tcpListener_0.AcceptSocket(); } else if (this.tcpListener_1 != null) { this.listenerSubState_0 = ListenerSubState.ExcutePendingV6; if (this.tcpListener_1.Pending()) { this.listenerSubState_0 = ListenerSubState.ExcuteAcceptSocketV6; socket = this.tcpListener_1.AcceptSocket(); } } if (socket == null) { this.listenerSubState_0 = ListenerSubState.IdleSleep; Thread.Sleep(this.int_4); return(true); } this.listenerSubState_0 = ListenerSubState.SetSocketOption; byte[] optionInValue = smethod_1(1, 0x4e20, 0x7d0); socket.IOControl(IOControlCode.KeepAliveValues, optionInValue, null); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, this.int_1); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, this.int_2); this.listenerSubState_0 = ListenerSubState.NewNetworkStream; NetworkStream stream = new NetworkStream(socket, true); this.listenerSubState_0 = ListenerSubState.SpringEstablishedEvent; if (this.bool_0) { this.eventSafeTrigger_0.ActionAsyn <NetworkStream, EndPoint>("TcpConnectionEstablished", this.TcpConnectionEstablished, stream, socket.RemoteEndPoint); } else { this.eventSafeTrigger_0.Action <NetworkStream, EndPoint>("TcpConnectionEstablished", this.TcpConnectionEstablished, stream, socket.RemoteEndPoint); } this.listenerSubState_0 = ListenerSubState.IdleSleep; return(true); } catch (Exception exception) { this.listenerSubState_0 = ListenerSubState.ExitWithException; this.iagileLogger_0.Log(exception, "CJFramework.AgileTcpListener.DoDetect - 异常导致监听线程退出。", ErrorLevel.High); return(false); } }