mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-17 06:18:58 +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);
|
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;
|
int i, rc;
|
||||||
|
|
||||||
if (sshbind == NULL) {
|
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)
|
int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, ssh_socket s)
|
||||||
{
|
{
|
||||||
ssh_poll_handle p;
|
ssh_poll_handle p = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
p = ssh_socket_get_poll_handle(s);
|
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.
|
* @return SSH_OK on success, SSH_ERROR otherwise.
|
||||||
*/
|
*/
|
||||||
int ssh_handle_packets(ssh_session session, int timeout) {
|
int ssh_handle_packets(ssh_session session, int timeout)
|
||||||
ssh_poll_handle spoll;
|
{
|
||||||
ssh_poll_ctx ctx;
|
ssh_poll_handle spoll = NULL;
|
||||||
|
ssh_poll_ctx ctx = NULL;
|
||||||
int tm = timeout;
|
int tm = timeout;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -654,11 +655,12 @@ int ssh_handle_packets(ssh_session session, int timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (timeout == SSH_TIMEOUT_USER) {
|
if (timeout == SSH_TIMEOUT_USER) {
|
||||||
if (ssh_is_blocking(session))
|
if (ssh_is_blocking(session)) {
|
||||||
tm = ssh_make_milliseconds(session->opts.timeout,
|
tm = ssh_make_milliseconds(session->opts.timeout,
|
||||||
session->opts.timeout_usec);
|
session->opts.timeout_usec);
|
||||||
else
|
} else {
|
||||||
tm = 0;
|
tm = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rc = ssh_poll_ctx_dopoll(ctx, tm);
|
rc = ssh_poll_ctx_dopoll(ctx, tm);
|
||||||
if (rc == SSH_ERROR) {
|
if (rc == SSH_ERROR) {
|
||||||
|
|||||||
12
src/socket.c
12
src/socket.c
@@ -401,7 +401,7 @@ ssh_poll_handle ssh_socket_get_poll_handle(ssh_socket s)
|
|||||||
if (s->poll_handle) {
|
if (s->poll_handle) {
|
||||||
return s->poll_handle;
|
return s->poll_handle;
|
||||||
}
|
}
|
||||||
s->poll_handle = ssh_poll_new(s->fd,0,ssh_socket_pollcallback,s);
|
s->poll_handle = ssh_poll_new(s->fd, 0, ssh_socket_pollcallback, s);
|
||||||
return s->poll_handle;
|
return s->poll_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,17 +513,23 @@ void ssh_socket_close(ssh_socket s)
|
|||||||
*/
|
*/
|
||||||
void ssh_socket_set_fd(ssh_socket s, socket_t fd)
|
void ssh_socket_set_fd(ssh_socket s, socket_t fd)
|
||||||
{
|
{
|
||||||
|
ssh_poll_handle h = NULL;
|
||||||
|
|
||||||
s->fd = fd;
|
s->fd = fd;
|
||||||
|
|
||||||
if (s->poll_handle) {
|
if (s->poll_handle) {
|
||||||
ssh_poll_set_fd(s->poll_handle,fd);
|
ssh_poll_set_fd(s->poll_handle,fd);
|
||||||
} else {
|
} else {
|
||||||
s->state = SSH_SOCKET_CONNECTING;
|
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 */
|
/* 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
|
#ifdef _WIN32
|
||||||
ssh_poll_add_events(ssh_socket_get_poll_handle(s), POLLWRNORM);
|
ssh_poll_add_events(h, POLLWRNORM);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user