From 8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Fri, 23 Jul 2010 08:27:05 +0200 Subject: Removed obsolete socket functions --- libssh/client.c | 4 --- libssh/packet.c | 4 +-- libssh/packet1.c | 6 ++-- libssh/socket.c | 108 +++++++++++++++++++++++++++---------------------------- 4 files changed, 58 insertions(+), 64 deletions(-) (limited to 'libssh') diff --git a/libssh/client.c b/libssh/client.c index 9a9d6a0..a7d803b 100644 --- a/libssh/client.c +++ b/libssh/client.c @@ -234,10 +234,6 @@ int ssh_send_banner(ssh_session session, int server) { return -1; } - if (ssh_socket_blocking_flush(session->socket) != SSH_OK) { - leave_function(); - return -1; - } #ifdef WITH_PCAP if(session->pcap_ctx) ssh_pcap_context_write(session->pcap_ctx,SSH_PCAP_DIR_OUT,buffer,strlen(buffer),strlen(buffer)); diff --git a/libssh/packet.c b/libssh/packet.c index a2a7837..ca8db17 100644 --- a/libssh/packet.c +++ b/libssh/packet.c @@ -444,12 +444,10 @@ static int ssh_packet_write(ssh_session session) { enter_function(); - ssh_socket_write(session->socket, + rc=ssh_socket_write(session->socket, ssh_buffer_get_begin(session->out_buffer), ssh_buffer_get_len(session->out_buffer)); - rc = packet_flush(session, 0); - leave_function(); return rc; } diff --git a/libssh/packet1.c b/libssh/packet1.c index 67aae4a..d4b2eae 100644 --- a/libssh/packet1.c +++ b/libssh/packet1.c @@ -303,12 +303,12 @@ int packet_send1(ssh_session session) { ssh_print_hexa("encrypted packet",ssh_buffer_get_begin(session->out_buffer), ssh_buffer_get_len(session->out_buffer)); #endif - if (ssh_socket_write(session->socket, ssh_buffer_get_begin(session->out_buffer), - ssh_buffer_get_len(session->out_buffer)) == SSH_ERROR) { + rc=ssh_socket_write(session->socket, ssh_buffer_get_begin(session->out_buffer), + ssh_buffer_get_len(session->out_buffer)); + if(rc== SSH_ERROR) { goto error; } - rc = packet_flush(session, 0); session->send_seq++; if (buffer_reinit(session->out_buffer) < 0) { diff --git a/libssh/socket.c b/libssh/socket.c index 9706d13..8c76dd1 100644 --- a/libssh/socket.c +++ b/libssh/socket.c @@ -3,7 +3,7 @@ * * This file is part of the SSH Library * - * Copyright (c) 2008,2009 by Aris Adamantiadis + * Copyright (c) 2008-2010 by Aris Adamantiadis * * The SSH Library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -505,59 +505,59 @@ void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd) { /** \internal * \brief reads blocking until len bytes have been read */ -int ssh_socket_completeread(ssh_socket s, void *buffer, uint32_t len) { - int r = -1; - uint32_t total = 0; - uint32_t toread = len; - if(! ssh_socket_is_open(s)) { - return SSH_ERROR; - } - - while((r = ssh_socket_unbuffered_read(s, ((uint8_t*)buffer + total), toread))) { - if (r < 0) { - return SSH_ERROR; - } - total += r; - toread -= r; - if (total == len) { - return len; - } - if (r == 0) { - return 0; - } - } - - /* connection closed */ - return total; -} - -/** \internal - * \brief Blocking write of len bytes - */ -int ssh_socket_completewrite(ssh_socket s, const void *buffer, uint32_t len) { - ssh_session session = s->session; - int written = -1; - - enter_function(); - - if(! ssh_socket_is_open(s)) { - leave_function(); - return SSH_ERROR; - } - - while (len >0) { - written = ssh_socket_unbuffered_write(s, buffer, len); - if (written == 0 || written == -1) { - leave_function(); - return SSH_ERROR; - } - len -= written; - buffer = ((uint8_t*)buffer + written); - } - - leave_function(); - return SSH_OK; -} +//int ssh_socket_completeread(ssh_socket s, void *buffer, uint32_t len) { +// int r = -1; +// uint32_t total = 0; +// uint32_t toread = len; +// if(! ssh_socket_is_open(s)) { +// return SSH_ERROR; +// } +// +// while((r = ssh_socket_unbuffered_read(s, ((uint8_t*)buffer + total), toread))) { +// if (r < 0) { +// return SSH_ERROR; +// } +// total += r; +// toread -= r; +// if (total == len) { +// return len; +// } +// if (r == 0) { +// return 0; +// } +// } +// +// /* connection closed */ +// return total; +//} +// +///** \internal +// * \brief Blocking write of len bytes +// */ +//int ssh_socket_completewrite(ssh_socket s, const void *buffer, uint32_t len) { +// ssh_session session = s->session; +// int written = -1; +// +// enter_function(); +// +// if(! ssh_socket_is_open(s)) { +// leave_function(); +// return SSH_ERROR; +// } +// +// while (len >0) { +// written = ssh_socket_unbuffered_write(s, buffer, len); +// if (written == 0 || written == -1) { +// leave_function(); +// return SSH_ERROR; +// } +// len -= written; +// buffer = ((uint8_t*)buffer + written); +// } +// +// leave_function(); +// return SSH_OK; +//} /** \internal * \brief buffered write of data -- cgit v1.2.3