diff svr-tcpfwd.c @ 1051:359fba4b1a49

merge tcp fastopen
author Matt Johnston <matt@ucc.asn.au>
date Sat, 28 Feb 2015 23:24:30 +0800
parents 0da8ba489c23
children c45d65392c1a
line wrap: on
line diff
--- a/svr-tcpfwd.c	Tue Feb 24 22:48:14 2015 +0800
+++ b/svr-tcpfwd.c	Sat Feb 28 23:24:30 2015 +0800
@@ -33,6 +33,7 @@
 #include "listener.h"
 #include "runopts.h"
 #include "auth.h"
+#include "netio.h"
 
 #ifndef ENABLE_SVR_REMOTETCPFWD
 
@@ -236,7 +237,6 @@
 	unsigned char* orighost = NULL;
 	unsigned int origport;
 	char portstring[NI_MAXSERV];
-	int sock;
 	int len;
 	int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED;
 
@@ -270,19 +270,7 @@
 	}
 
 	snprintf(portstring, sizeof(portstring), "%d", destport);
-	sock = connect_remote(desthost, portstring, NULL);
-	if (sock < 0) {
-		err = SSH_OPEN_CONNECT_FAILED;
-		TRACE(("leave newtcpdirect: sock failed"))
-		goto out;
-	}
-
-	ses.maxfd = MAX(ses.maxfd, sock);
-
-	 /* We don't set readfd, that will get set after the connection's
-	 * progress succeeds */
-	channel->writefd = sock;
-	channel->initconn = 1;
+	channel->conn_pending = connect_remote(desthost, portstring, channel_connect_done, channel);
 
 	channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE;