Skip to content

Commit

Permalink
Add session error handler in getSession
Browse files Browse the repository at this point in the history
  • Loading branch information
Sverre Johan Tøvik committed Jul 29, 2022
1 parent 32b977f commit 1dd749c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gapit-snmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ module.exports = function (RED) {
sessions[sessionKey] = snmp.createSession(host, node.config.community, options);
}

sessions[sessionKey].on("error", function (error) {
console.log ("Session error: " + error.toString());
node.closeSession();
})

node.sessionKey = sessionKey;
return sessions[sessionKey];
}
Expand Down

0 comments on commit 1dd749c

Please sign in to comment.