public void WriteCommand(Command command) { if (command.Name.SequenceEqual(PUB_BYTES)) { _pubCh.Send(true); } }
/// <summary> /// WriteCommand is a thread safe method to write a Command /// to this connection, and flush. /// </summary> public void WriteCommand(Command cmd) { if (cmd == null) throw new ArgumentNullException("cmd"); try { lock (_mtx) { int size = cmd.GetByteCount(); if (size > _bigBufSize) { _bigBuf = new byte[size]; _bigBufSize = size; } cmd.WriteTo(this, _bigBuf); Flush(); } } catch (Exception ex) { log(LogLevel.Error, string.Format("IO error - {0}", ex)); _delegate.OnIOError(this, ex); throw; } }