Sha256: 69d30845cf371ac8264d7d633d499ead50acb1e3b7281c6b2d400715ce12c1fa

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

module Libvirt
  class NetworkDhcpLease < BaseInfo
    struct_class FFI::Network::DhcpLeaseStruct

    # @param pointer [FFI::Pointer]
    def initialize(pointer)
      super

      free = ->(obj_id) do
        dbg { "Finalize Libvirt::NetworkDhcpLease object_id=0x#{obj_id.to_s(16)}, pointer=0x#{@ptr.address.to_s(16)}" }
        return unless @ptr

        warn "Couldn't free Libvirt::NetworkDhcpLease object_id=0x#{obj_id.to_s(16)}, pointer=0x#{@ptr.address.to_s(16)}" if FFI::Storage.virNetworkDHCPLeaseFree(@ptr).negative?
      end
      ObjectSpace.define_finalizer(self, free)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libvirt_ffi-0.8.1 lib/libvirt/network_dhcp_lease.rb
libvirt_ffi-0.8.0 lib/libvirt/network_dhcp_lease.rb