From c53b6b907ce7ccaf720777c18eed3eea46807bb7 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Wed, 26 Oct 2005 16:59:16 +0000 Subject: resolved the infinite loop on exit (thanks giga for the hint). I resolved a memory alloc problem into hmac_init (same kind that the one of md5_init). It's still saying there is a memory corruption. Since the memory corruption happens before it is found (in malloc()), I'll have to run valgrind to locate it. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@46 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/session.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libssh/session.c') diff --git a/libssh/session.c b/libssh/session.c index 0d75c5a..016c127 100644 --- a/libssh/session.c +++ b/libssh/session.c @@ -112,6 +112,21 @@ void ssh_set_fd_except(SSH_SESSION *session){ session->data_except=1; } +/* looks if there is data to read on the socket and parse it. */ +int ssh_handle_packets(SSH_SESSION *session){ + int w,err,r; + do { + r=ssh_fd_poll(session,&w,&err); + if(r<=0) + return r; // error or no data available + /* if an exception happened, it will be trapped by packet_read() */ + if(packet_read(session)||packet_translate(session)) + return -1; + packet_parse(session); + } while(r>0); + return r; +} + int ssh_get_status(SSH_SESSION *session){ int ret=0; if(session->closed) -- cgit