changeset 1050:c2a50c9f509e fastopen

Add cleanup
author Matt Johnston <matt@ucc.asn.au>
date Sat, 28 Feb 2015 23:15:23 +0800
parents 01eea88963f3
children 359fba4b1a49
files common-session.c netio.c netio.h
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common-session.c	Sat Feb 28 09:06:40 2015 +0800
+++ b/common-session.c	Sat Feb 28 23:15:23 2015 +0800
@@ -281,6 +281,8 @@
 	other session state is freed. */
 	remove_all_listeners();
 
+	remove_connect_pending();
+
 	while (!isempty(&ses.writequeue)) {
 		buf_free(dequeue(&ses.writequeue));
 	}
--- a/netio.c	Sat Feb 28 09:06:40 2015 +0800
+++ b/netio.c	Sat Feb 28 23:15:23 2015 +0800
@@ -177,6 +177,13 @@
 	return c;
 }
 
+void remove_connect_pending() {
+	while (ses.conn_pending.first) {
+		struct dropbear_progress_connection *c = ses.conn_pending.first->item;
+		remove_connect(c, ses.conn_pending.first);
+	}
+}
+
 
 void set_connect_fds(fd_set *writefd) {
 	m_list_elem *iter;
--- a/netio.h	Sat Feb 28 09:06:40 2015 +0800
+++ b/netio.h	Sat Feb 28 23:15:23 2015 +0800
@@ -30,8 +30,12 @@
 struct dropbear_progress_connection * connect_remote (const char* remotehost, const char* remoteport,
 	connect_callback cb, void *cb_data);
 
+/* Sets up for select() */
 void set_connect_fds(fd_set *writefd);
+/* Handles ready sockets after select() */
 void handle_connect_fds(fd_set *writefd);
+/* Cleanup */
+void remove_connect_pending();
 
 /* Doesn't actually stop the connect, but adds a dummy callback instead */
 void cancel_connect(struct dropbear_progress_connection *c);