shithub: 9pro

Download patch

ref: 8b670ed42a11f902584582651e24aeccf8667405
parent: 2e5cce691c7b3975ca028fd3dcd977cc714683ae
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri May 22 11:07:59 EDT 2020

9gc: don't remove Joined flag after disconnect/error

--- a/9gc.c
+++ b/9gc.c
@@ -23,9 +23,8 @@
 	Chatfid,
 
 	Error = 1<<0,
-	Eof = 1<<1,
-	Joined = 1<<2,
-	Disconnected = 1<<3,
+	Joined = 1<<1,
+	Disconnected = 1<<2,
 };
 
 typedef struct C9aux C9aux;
@@ -57,7 +56,7 @@
 		if ((r = read(a->f, a->rdbuf+n, size-n)) <= 0) {
 			if (errno == EINTR)
 				continue;
-			a->flags = Disconnected;
+			a->flags |= Disconnected;
 			close(a->f);
 			return NULL;
 		}
@@ -418,8 +417,8 @@
 		if ((a = registry()) == NULL)
 			return 1;
 		while (chatrw(a) == 0 && wrsend(a) == 0);
-		if (a->flags & Disconnected) {
-			a->flags = 0;
+		if (a->flags & (Disconnected|Error)) {
+			a->flags &= ~(Disconnected|Error);
 			skipuntil = chatoff;
 			chatoff = 0;
 			free(a);