napalm-automation / napalm-base

Apache License 2.0
32 stars 48 forks source link

Check if connection is alive before closing #235

Closed dbarrosop closed 7 years ago

dbarrosop commented 7 years ago

Fixes https://github.com/napalm-automation/napalm-ios/issues/135

@gjim83 @mirceaulinic comments?

gjim83 commented 7 years ago

This is what I thought at some point while discussing https://github.com/napalm-automation/napalm-base/commit/842a801aba325b0bd85772cb9a5fd2e87ecfe6f2 but then decided back on ignoring the exception. That was because I wasn't sure I was aware of all the actions that all drivers take when closing, that wouldn't be tied to closing the socket (when applicable). However, I'd say this works safely, more so when taking into account this comment here https://github.com/paramiko/paramiko/blob/master/paramiko/channel.py#L1133 :)