[SNMP4J] resource leak on failed connect in AgentXSubagent.connect()
Frank Fock
fock at agentpp.com
Fri Mar 16 00:38:36 CET 2007
Hi Larry,
Thanks for the fix. I have included it into the next update
release 1.0a.
Best regards,
Frank
Sachs, Larry wrote:
> Hi,
>
>
>
> The newly released snmp-agentx 1.0 fixes much of the resource leak on a
> failed connect. I still believe there is a small hole. I recommend the
> following in AgentXSubagent.connect()...
>
>
>
> --- AgentXSubagent.java
>
> ***************
>
> *** 229,248 ****
>
> --- 229,249 ----
>
> int status = AgentXProtocol.AGENTX_TIMEOUT;
>
> try {
>
> status = openSession(transport, masterAddress, session);
>
> if (status != AgentXProtocol.AGENTX_TIMEOUT) {
>
> peers.put(masterAddress, peer);
>
> LOGGER.info("Added new peer
> address="+masterAddress+",peer="+peer);
>
> }
>
> }
>
> catch (IOException ex) {
>
> LOGGER.error(ex);
>
> + removeMaster(transport);
>
> return AgentXProtocol.AGENTX_ERROR;
>
> }
>
> if (status == AgentXProtocol.AGENTX_SUCCESS) {
>
> sessions.put(new Integer(session.getSessionID()), session);
>
> LOGGER.info("Opened subagent session successfully: "+session);
>
> }
>
> else {
>
> removeMaster(transport);
>
> }
>
> return status;
>
>
>
> Thanks,
>
> ls
>
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list