Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/net/snmp/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def initialize(options = {})
auth_key_result = Wrapper.generate_Ku(@sess.securityAuthProto,
@sess.securityAuthProtoLen,
options[:auth_password],
options[:auth_password].length,
options[:auth_password].bytesize,
@sess.securityAuthKey,
auth_len_ptr)
@sess.securityAuthKeyLen = auth_len_ptr.read_int
Expand All @@ -150,7 +150,7 @@ def initialize(options = {})
priv_key_result = Wrapper.generate_Ku(@sess.securityAuthProto,
@sess.securityAuthProtoLen,
options[:priv_password],
options[:priv_password].length,
options[:priv_password].bytesize,
@sess.securityPrivKey,
priv_len_ptr)
@sess.securityPrivKeyLen = priv_len_ptr.read_int
Expand All @@ -171,10 +171,12 @@ def initialize(options = {})
def close
if Net::SNMP.thread_safe
self.class.lock.synchronize {
Wrapper.snmp_sess_close(@struct)
Wrapper..shutdown_usm()
Wrapper.snmp_sess_close(@struct)
self.class.sessions.delete(self.sessid)
}
else
Wrapper.shutdown_usm()
Wrapper.snmp_sess_close(@struct)
self.class.sessions.delete(self.sessid)
end
Expand Down
2 changes: 2 additions & 0 deletions lib/net/snmp/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ class IndexList < NiceFFI::Struct
#attach_function :send_easy_trap, [:int, :int], :void
#attach_function :send_trap_vars, [:int, :int, :pointer], :void
#attach_function :send_v2trap, [:pointer], :void

attach_function :shutdown_usm, [], :void

def self.get_fd_set
FFI::MemoryPointer.new(:pointer, 128)
Expand Down