From 1b1997bf2da9322c526ec1da4358aae94f7de06e Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Fri, 20 Feb 2015 22:13:53 +0800
Subject: [PATCH] Update priority once the socket is open

--HG--
branch : fastopen
---
 cli-session.c    | 1 +
 common-session.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/cli-session.c b/cli-session.c
index c2e4863b..8cd75f83 100644
--- a/cli-session.c
+++ b/cli-session.c
@@ -100,6 +100,7 @@ void cli_connected(int result, int sock, void* userdata, const char *errstring)
 		dropbear_exit("Connect failed: %s", errstring);
 	}
 	ses.sock_in = ses.sock_out = sock;
+	update_channel_prio();
 }
 
 void cli_session(int sock_in, int sock_out, struct dropbear_progress_connection *progress) {
diff --git a/common-session.c b/common-session.c
index 6ca7f547..d95c2eea 100644
--- a/common-session.c
+++ b/common-session.c
@@ -552,6 +552,11 @@ void update_channel_prio() {
 
 	TRACE(("update_channel_prio"))
 
+	if (ses.sock_out < 0) {
+		TRACE(("leave update_channel_prio: no socket"))
+		return;
+	}
+
 	new_prio = DROPBEAR_PRIO_BULK;
 	for (i = 0; i < ses.chansize; i++) {
 		struct Channel *channel = ses.channels[i];
-- 
GitLab