about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-05-27 15:09:19 +0300
committerNakidai <nakidai@disroot.org>2025-05-27 15:09:19 +0300
commit6142f7194f697bcc0b345612caa8f55fc201c380 (patch)
treecde1c207c430a2245adf5de20ac56b3588f98769
parentae5bd54066fc78455eb0e53956ec4c10ad0e03b9 (diff)
downloadttb-master.tar.gz
ttb-master.zip
Fix broadcasting HEAD v1.0.2 master
When iterating through receivers code was assuming that ppeers[n].fd ==
peers[n] that is wrong.

Noticed in #1 by @aureliumsk:
https://github.com/nakidai/ttb/issues/1
-rw-r--r--ttb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ttb.c b/ttb.c
index 8f0c561..460fd5c 100644
--- a/ttb.c
+++ b/ttb.c
@@ -103,7 +103,7 @@ after:
 			}
 
 			for (size_t j = 1; j < lengthof(peers); ++j)
-				if (peers[j] && i != j)
+				if (peers[j] && ppeers[i].fd != peers[j])
 					while (errno = 0, write(peers[j], buf, reads), errno == EINTR);
 		}
 	}