1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

Fix double-connect testcase

This commit is contained in:
Aris Adamantiadis
2011-01-15 22:43:58 +01:00
parent f8361d324e
commit b945cbca52
3 changed files with 73 additions and 2 deletions

View File

@@ -157,6 +157,25 @@ ssh_socket ssh_socket_new(ssh_session session) {
return s;
}
/**
* @internal
* @brief Reset the state of a socket so it looks brand-new
* @param[in] s socket to rest
*/
void ssh_socket_reset(ssh_socket s){
s->fd_in = SSH_INVALID_SOCKET;
s->fd_out= SSH_INVALID_SOCKET;
s->last_errno = -1;
s->fd_is_socket = 1;
buffer_reinit(s->in_buffer);
buffer_reinit(s->out_buffer);
s->read_wontblock = 0;
s->write_wontblock = 0;
s->data_except = 0;
s->poll_in=s->poll_out=NULL;
s->state=SSH_SOCKET_NONE;
}
/**
* @internal
* @brief the socket callbacks, i.e. callbacks to be called