mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-18 18:34:10 +03:00
Reformat and initialize pointers
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -424,7 +424,8 @@ void ssh_bind_free(ssh_bind sshbind){
|
||||
SAFE_FREE(sshbind);
|
||||
}
|
||||
|
||||
int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){
|
||||
int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd)
|
||||
{
|
||||
int i, rc;
|
||||
|
||||
if (sshbind == NULL) {
|
||||
|
||||
@@ -621,7 +621,7 @@ int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p)
|
||||
*/
|
||||
int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, ssh_socket s)
|
||||
{
|
||||
ssh_poll_handle p;
|
||||
ssh_poll_handle p = NULL;
|
||||
int ret;
|
||||
|
||||
p = ssh_socket_get_poll_handle(s);
|
||||
|
||||
@@ -634,9 +634,10 @@ void ssh_set_fd_except(ssh_session session) {
|
||||
*
|
||||
* @return SSH_OK on success, SSH_ERROR otherwise.
|
||||
*/
|
||||
int ssh_handle_packets(ssh_session session, int timeout) {
|
||||
ssh_poll_handle spoll;
|
||||
ssh_poll_ctx ctx;
|
||||
int ssh_handle_packets(ssh_session session, int timeout)
|
||||
{
|
||||
ssh_poll_handle spoll = NULL;
|
||||
ssh_poll_ctx ctx = NULL;
|
||||
int tm = timeout;
|
||||
int rc;
|
||||
|
||||
@@ -654,12 +655,13 @@ int ssh_handle_packets(ssh_session session, int timeout) {
|
||||
}
|
||||
|
||||
if (timeout == SSH_TIMEOUT_USER) {
|
||||
if (ssh_is_blocking(session))
|
||||
if (ssh_is_blocking(session)) {
|
||||
tm = ssh_make_milliseconds(session->opts.timeout,
|
||||
session->opts.timeout_usec);
|
||||
else
|
||||
} else {
|
||||
tm = 0;
|
||||
}
|
||||
}
|
||||
rc = ssh_poll_ctx_dopoll(ctx, tm);
|
||||
if (rc == SSH_ERROR) {
|
||||
session->session_state = SSH_SESSION_STATE_ERROR;
|
||||
|
||||
10
src/socket.c
10
src/socket.c
@@ -513,17 +513,23 @@ void ssh_socket_close(ssh_socket s)
|
||||
*/
|
||||
void ssh_socket_set_fd(ssh_socket s, socket_t fd)
|
||||
{
|
||||
ssh_poll_handle h = NULL;
|
||||
|
||||
s->fd = fd;
|
||||
|
||||
if (s->poll_handle) {
|
||||
ssh_poll_set_fd(s->poll_handle,fd);
|
||||
} else {
|
||||
s->state = SSH_SOCKET_CONNECTING;
|
||||
h = ssh_socket_get_poll_handle(s);
|
||||
if (h == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* POLLOUT is the event to wait for in a nonblocking connect */
|
||||
ssh_poll_set_events(ssh_socket_get_poll_handle(s), POLLOUT);
|
||||
ssh_poll_set_events(h, POLLOUT);
|
||||
#ifdef _WIN32
|
||||
ssh_poll_add_events(ssh_socket_get_poll_handle(s), POLLWRNORM);
|
||||
ssh_poll_add_events(h, POLLWRNORM);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user