BenMenking / routeros-api

Client API for RouterOS/Mikrotik
338 stars 270 forks source link

Should there be a __destruct() method that closes the connection if it's left open? #1

Closed scottchiefbaker closed 9 years ago

scottchiefbaker commented 9 years ago

For consistency we should probably always close the connection. Should we have a destructor that does this automatically?

BenMenking commented 9 years ago

Technically speaking, PHP will close the connection when the script completes. But you've brought up a very valid question in a situation where the routeros-api object was created and then unset at a later point in the script. For long running scripts and in this scenario the socket would still be open (and possibly timeout) but for clarity and completeness, I think it's a great idea.

Ben Menking IT Security Consulting ben@infotechsc.com ben@infotechsc.com Phone: 864.420.5603

On Mon, Aug 31, 2015 at 11:06 AM, Scott Baker notifications@github.com wrote:

For consistency we should probably always close the connection. Should we have a destructor that does this automatically?

— Reply to this email directly or view it on GitHub https://github.com/BenMenking/routeros-api/issues/1.

scottchiefbaker commented 9 years ago

Ok great... I'll whip up a pull request. It'll be a good excuse to dive in.

scottchiefbaker commented 9 years ago

Ben merged it...