shithub: 9pro

Download patch

ref: bfd4cf4e76dcb1e9ab644b3ecd06b4268363d234
parent: a7b4dd4caec8a65cee0156e355c6cb18aea4b834
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Thu Nov 26 18:12:50 EST 2020

actually make it work

--- a/9gc.c
+++ b/9gc.c
@@ -42,8 +42,8 @@
 static const char *nick;
 static int printjoin;
 static uint64_t chatoff, skipuntil;
-static char *registry = "tcp!registry.9gridchan.org!6675";
-static char *defsrv = "tcp!chat.9gridchan.org!9997";
+static char *regsrv = "tcp!registry.9gridchan.org!6675";
+static char *chatsrv = "tcp!chat.9gridchan.org!9997";
 
 static uint8_t *
 ctxread(C9ctx *ctx, uint32_t size, int *err)
@@ -257,7 +257,7 @@
 				return;
 			}
 		}
-		b = defsrv;
+		b = chatsrv;
 		goto fallback;
 
 	case Rerror:
@@ -309,17 +309,15 @@
 	int i;
 
 	for (i = 0; i < 10; i++) {
-		if ((a = srv(registry)) != NULL)
-			break;
-		sleep(5);
-	}
-	if (a == NULL) {
-		if ((a = srv(defsrv)) != NULL) {
-			ctx->r = ctxchatR;
-			c9version(ctx, &tag, Msize);
-			wrsend(a);
+		if ((a = srv(regsrv)) == NULL) {
+			if ((a = srv(chatsrv)) != NULL) {
+				a->c.r = ctxchatR;
+				c9version(&a->c, &tag, Msize);
+				wrsend(a);
+				return a;
+			}
+			free(a);
 		}
-		return a;
 	}
 
 	a->c.r = ctxregistryR;