aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2010-08-08 23:03:50 +0200
committerAndreas Schneider <asn@cynapses.org>2010-08-09 20:54:23 +0200
commit7a68331fcd311c79341c66d2174cc45876dd4755 (patch)
treed883f4724de6e469eabebd9866b50a07386d343f /libssh
parentd896d6393b94afa068775ab34dc6d8ba3b46e177 (diff)
downloadlibssh-7a68331fcd311c79341c66d2174cc45876dd4755.tar.gz
libssh-7a68331fcd311c79341c66d2174cc45876dd4755.tar.xz
libssh-7a68331fcd311c79341c66d2174cc45876dd4755.zip
messages: Make sure we pop the message at the beginning.
Signed-off-by: Andreas Schneider <asn@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r--libssh/messages.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libssh/messages.c b/libssh/messages.c
index ef925cd..867f941 100644
--- a/libssh/messages.c
+++ b/libssh/messages.c
@@ -723,6 +723,15 @@ int ssh_message_channel_request_reply_success(ssh_message msg) {
ssh_message ssh_message_get(ssh_session session) {
ssh_message msg = NULL;
enter_function();
+
+ msg=ssh_message_pop_head(session);
+ if(msg) {
+ leave_function();
+ return msg;
+ }
+ if(session->ssh_message_list == NULL) {
+ session->ssh_message_list = ssh_list_new();
+ }
do {
if (ssh_handle_packets(session,-1) == SSH_ERROR) {
leave_function();
@@ -730,7 +739,6 @@ ssh_message ssh_message_get(ssh_session session) {
}
msg=ssh_list_pop_head(ssh_message, session->ssh_message_list);
} while(msg==NULL);
- msg=ssh_message_pop_head(session);
leave_function();
return msg;
}