Commit Diff


commit - c51c42e44b2f0880f1e1db4f831c079fcd1d9afc
commit + 848779c243d5d3a4af0e15ceda528fe27209ac00
blob - 496b93a48463f6ddae9bc1edbdd3401dab8db96f
blob + 97cc25a2727971bb9bc8c2e03ca092bf0b5aa6c0
--- gemini.c
+++ gemini.c
@@ -84,11 +84,11 @@ static void		 handle_dispatch_imsg(int, short, void*);
 struct timeval timeout_for_handshake = { 5, 0 };
 
 static imsg_handlerfn *handlers[] = {
-	[IMSG_GET] = handle_get,
-	[IMSG_CERT_STATUS] = handle_cert_status,
-	[IMSG_PROCEED] = handle_proceed,
-	[IMSG_STOP] = handle_stop,
-	[IMSG_QUIT] = handle_quit,
+	[IMSG_GET]		= handle_get,
+	[IMSG_CERT_STATUS]	= handle_cert_status,
+	[IMSG_PROCEED]		= handle_proceed,
+	[IMSG_STOP]		= handle_stop,
+	[IMSG_QUIT]		= handle_quit,
 };
 
 typedef void (*statefn)(int, short, void*);
@@ -147,6 +147,7 @@ try_to_connect(int fd, short ev, void *d)
 	int		 error = 0;
 	socklen_t	 len = sizeof(error);
 
+again:
 	if (req->p == NULL)
 		goto err;
 
@@ -163,7 +164,7 @@ try_to_connect(int fd, short ev, void *d)
 	req->fd = socket(req->p->ai_family, req->p->ai_socktype, req->p->ai_protocol);
 	if (req->fd == -1) {
 		req->p = req->p->ai_next;
-		try_to_connect(fd, ev, req);
+		goto again;
 	} else {
 		mark_nonblock(req->fd);
 		if (connect(req->fd, req->p->ai_addr, req->p->ai_addrlen) == 0)