epiecs/phpmiko

Automatically disconnecting after every command increases processing time

murrant opened this issue · 2 comments

8fdddf0 broke my code flow:
Connect.
*fetch ipv4 data
*fetch ipv6 data
formulate new commands
*send ipv4 config changes
*send ipv6 config changes
disconnect

It now disconnects after every command (the asterisks), setting $deviceConnection to null and throwing a null exception when the next command is run. Reconnecting after every command adds significant time.

Options to fix:

  1. create a command sequence class that disconnects on destruct
  2. force the user to manually disconnect
  3. create a config option "disconnect after commands"

Hi,

Good point. Maybe the best way to implement this then would be via __destruct(). Then it will behave more like using with in Python.

Allowing the using to manually disconnect should also always be available.

I will try and post a fix later today.

Kr, Gregory

Hi,

This should be fixed now :)

https://github.com/epiecs/phpmiko/releases/tag/v1.1.3

The release should be picked up by packagist shortly.

Kr, Gregory