[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] session: skip timestamp init for non-blocking case


Attached is a patch which skips ssh_timestamp_init in the
ssh_handle_packets_termination loop for the non-blocking
case.  This avoids a syscall for every ssh_channel_flush
for example.


-Jon
From 33cf8c9400bdb58f2bedea3517844742c64351a5 Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Tue, 4 Feb 2014 19:04:16 -0800
Subject: [PATCH] session: skip timestamp init for non-blocking case

---
 src/session.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/session.c b/src/session.c
index 4d63a19..65fb4b1 100644
--- a/src/session.c
+++ b/src/session.c
@@ -567,7 +567,11 @@ int ssh_handle_packets_termination(ssh_session session,
         }
     }
 
-    ssh_timestamp_init(&ts);
+    /* avoid unnecessary syscall for the SSH_TIMEOUT_NONBLOCKING case */
+    if (timeout != SSH_TIMEOUT_NONBLOCKING) {
+        ssh_timestamp_init(&ts);
+    }
+
     tm = timeout;
     while(!fct(user)) {
         ret = ssh_handle_packets(session, tm);
-- 
1.8.4.21.g992c386


Archive administrator: postmaster@lists.cynapses.org