def read_loop
      loop do
        unless @options.fetch(:device)
          sleep 0.1
          next
        end
        begin
          raw_data, = raw_socket.recvfrom(8192)
          udp = Pio::Udp.read(raw_data)
          next if @stop
          unless @options[:promisc]
            next if udp.destination_ip_address != @options.fetch(:ip_address)
          end
          @logger.info "Received: #{udp}"
          @packets_received << udp.snapshot
        rescue Errno::ENETDOWN
          # link is disconnected
          sleep 1
        end
      end
    end
def read_loop
      loop do
        unless @options.fetch(:device)
          sleep 0.1
          next
        end
        begin
          raw_data, = raw_socket.recvfrom(8192)
          udp = Pio::Udp.read(raw_data)
          next if @stop
          unless @options[:promisc]
            next if udp.destination_ip_address != @options.fetch(:ip_address)
          end
          @logger.info "Received: #{udp}"
          @packets_received << udp.snapshot
        rescue Errno::ENETDOWN
          # link is disconnected
          sleep 1
        end
      end
    end
rubocop:disable MethodLength
 rubocop:disable AbcSize