summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-02-28 23:15:23 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-02-28 23:15:23 +0800
commitfe580746d9d32a238ffcf03b122fcd97e1e3b1e9 (patch)
treecc1bf04cc4814b398bab9ab247573fb9eb5dcafe
parentdef16fd87052cf80b08eb9e7a9ee621ed4c5cbcd (diff)
downloaddropbear-fastopen.tar.gz
Add cleanupfastopen
-rw-r--r--common-session.c2
-rw-r--r--netio.c7
-rw-r--r--netio.h4
3 files changed, 13 insertions, 0 deletions
diff --git a/common-session.c b/common-session.c
index 19247a8..be8f776 100644
--- a/common-session.c
+++ b/common-session.c
@@ -281,6 +281,8 @@ void session_cleanup() {
other session state is freed. */
remove_all_listeners();
+ remove_connect_pending();
+
while (!isempty(&ses.writequeue)) {
buf_free(dequeue(&ses.writequeue));
}
diff --git a/netio.c b/netio.c
index 9aa7ae5..42d1b32 100644
--- a/netio.c
+++ b/netio.c
@@ -177,6 +177,13 @@ struct dropbear_progress_connection *connect_remote(const char* remotehost, cons
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;
diff --git a/netio.h b/netio.h
index 280ccaf..1bf08ce 100644
--- a/netio.h
+++ b/netio.h
@@ -30,8 +30,12 @@ typedef void(*connect_callback)(int result, int sock, void* data, const char* er
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);