php / pecl-networking-ssh2

Bindings for the libssh2 library
http://pecl.php.net/package/ssh2
Other
51 stars 61 forks source link

Added ssh2_disconnect and ssh2_close functions #10

Closed credomane closed 8 years ago

credomane commented 8 years ago

Also converted some space indentations to tabs for consistency with the rest of the file.

langemeijer commented 8 years ago

Have you seen the php_ssh2_session_dtor() function? That function gets called when you unset the connection resource variable. This function does way more housekeeping, destroying the ssh2 data, closing the socket and finally calling libssh2_session_free().

If you want to implement ssh2_disconnect(), please make PHP_FUNCTION(ssh2_disconnect) call php_ssh2_session_dtor()

Also, can you explain the rationale behind aliassing this function to ssh2_close()?

credomane commented 8 years ago

Have you seen the php_ssh2_session_dtor() function?

I'm still fairly new to php core/extension development and at the time I didn't understand how/when/why that function was called. I did try to use it initially but I had some unexplainable segfault issues. That caused my really ugly ssh2_disconnect to come into being. There were also some other non-ssh2 related segfault issues with php 7.0.2 that decided to return to 5.6 for a while. Picked up 7.0.4 early last week and my segfault issues are gone. Thus I'll play around with using php_ssh2_session_dtor directory again instead of my ugly custom function code.

Also, can you explain the rationale behind aliassing this function to ssh2_close()?

I swear there was an ssh2_open aliased to ssh2_connect. So I made ssh2_close to maintain consistency but looking again there is no such thing. I'll remove it as it is unneeded.

Also when I make the changes and submit them. Do you want me to close this pull request and open a new one with the "squished" commits or just add to this pull request?

langemeijer commented 8 years ago

Please close this one. If you want to implement ssh2_disconnect(), please make PHP_FUNCTION(ssh2_disconnect) call php_ssh2_session_dtor() in a new pull request.

credomane commented 8 years ago

Closing pull request as requested. I'll get the corrected pull request up when I get some time later today. Haven't had any issues using php_ssh2_session_dtor() directly.