aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-07-23 08:27:05 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-07-23 08:27:05 +0200
commit8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f (patch)
treeeb59a0440c4166fdb79eb1ba7c88a1bd0d4c10b2 /libssh
parente5542b027bf2a4df0174dab29a806fda05f7cbd8 (diff)
downloadlibssh-8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f.tar.gz
libssh-8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f.tar.xz
libssh-8cd0d0040e70b5a1ab0a8d8588190dd88f17ce4f.zip
Removed obsolete socket functions
Diffstat (limited to 'libssh')
-rw-r--r--libssh/client.c4
-rw-r--r--libssh/packet.c4
-rw-r--r--libssh/packet1.c6
-rw-r--r--libssh/socket.c108
4 files changed, 58 insertions, 64 deletions
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