~ruther/NosSmooth

3f0d3a8d38a2dd5ee84a35164bc37c039e41e4af — Rutherther 2 years ago 1d2c2cd
feat(pcap): keep last pcap live device in client
1 files changed, 8 insertions(+), 2 deletions(-)

M Pcap/NosSmooth.Pcap/PcapNostaleClient.cs
M Pcap/NosSmooth.Pcap/PcapNostaleClient.cs => Pcap/NosSmooth.Pcap/PcapNostaleClient.cs +8 -2
@@ 40,7 40,9 @@ public class PcapNostaleClient : BaseNostaleClient
    private CryptographyManager _crypto;
    private CancellationToken? _stoppingToken;
    private bool _running;
    private LibPcapLiveDevice? _lastDevice;
    private TcpConnection _connection;
    private long _lastPacketIndex;

    /// <summary>
    /// Initializes a new instance of the <see cref="PcapNostaleClient"/> class.


@@ 183,15 185,18 @@ public class PcapNostaleClient : BaseNostaleClient
    /// <summary>
    /// Called when an associated packet has been obtained.
    /// </summary>
    /// <param name="device">The device the packet was received at.</param>
    /// <param name="connection">The connection that obtained the packet.</param>
    /// <param name="payloadData">The raw payload data of the packet.</param>
    internal void OnPacketArrival(TcpConnection connection, byte[] payloadData)
    internal void OnPacketArrival(LibPcapLiveDevice? device, TcpConnection connection, byte[] payloadData)
    {
        _lastDevice = device;

        string data;
        PacketSource source;
        bool containsPacketId = false;

        if (connection.LocalAddr == _localAddr && connection.LocalPort == _localPort)
        if (connection.LocalAddr == _connection.LocalAddr && connection.LocalPort == _connection.LocalPort)
        { // sent packet
            source = PacketSource.Client;
            if (_crypto.EncryptionKey == 0)


@@ 236,6 241,7 @@ public class PcapNostaleClient : BaseNostaleClient
                var linePacket = line;
                if (containsPacketId)
                {
                    _lastPacketIndex = int.Parse(line.Substring(0, line.IndexOf(' ')));
                    linePacket = line.Substring(line.IndexOf(' ') + 1);
                }


Do not follow this link