public override void OnData(DataFragment data) { lock (_cipherSync) { try { if (!_keyError) { // key error detection if (_pending && DateTime.UtcNow > _keyErrorDetectionTimeout) { _keyError = true; // disable accepting data any more return; } _buffer.Append(data); if (!_pending) { ProcessBuffer(); } } } catch (Exception ex) { OnError(ex); } } }
public override void OnData(DataFragment data) { try { _buffer.Append(data); //ここで複数パケットを一括して受け取った場合を考慮している while (ConstructPacket()) { _inner_handler.OnData(_packet); } } catch (Exception ex) { OnError(ex); } }
public override void OnData(DataFragment data) { try { _buffer.Append(data); //ここで複数パケットを一括して受け取った場合を考慮している while (ConstructPacket()) { if (_packet.Length >= 1 && _packet.ByteAt(0) == (byte)PacketType.SSH_MSG_NEWKEYS) { // next packet must be decrypted with the new key lock (_cipherSync) { _waitingNewCipher = true; // Note: SSH2SynchronizedPacketReceiver.OnData() queue the packet then // wait until the packet is dequeued _inner_handler.OnData(_packet); Monitor.Wait(_cipherSync, 1000); if (_waitingNewCipher) { // something is going wrong... _waitingNewCipher = false; _cipher = null; _mac = null; _macEnabled = false; _head = null; } } } else { _inner_handler.OnData(_packet); } } } catch (Exception ex) { OnError(ex); } }