public void ReadAndVerifyState(DotRLGlueCodec.Network.RlGlueConnection.ConnectionState state) { DotRLGlueCodec.Network.RlGlueConnection.ConnectionState rlGlueState; this.rlGlueConnection .Receive() .State(out rlGlueState) .And() .DiscardInteger(); if (rlGlueState != state) { throw new InvalidDataException(); } }
private void Disconnect(DotRLGlueCodec.Network.RlGlueConnection.ConnectionState cs) { if (this.rlGlueConnection == null) { return; } this.rlGlueConnection .Send() .State(cs) .And() .SizeOfState() .Flush(); ReadAndVerifyState(cs); this.rlGlueConnection .Send() .State(DotRLGlueCodec.Network.RlGlueConnection.ConnectionState.RLTerminate) .And() .SizeOfState() .Flush(); this.rlGlueConnection.Close(); }