summaryrefslogtreecommitdiffstats
path: root/src/main/java/derms/net/rmulticast/Announce.java
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-11-16 10:39:06 -0500
committerSam Anthony <sam@samanthony.xyz>2024-11-16 10:39:06 -0500
commite0196b370e8da38d366d327da57186dd3a44c2b2 (patch)
tree673384668db4a6bf39433224196c673d5ebfc9f5 /src/main/java/derms/net/rmulticast/Announce.java
parentabb23793ff85515237b8bd5d4b0e7e8e3be0af9a (diff)
downloadsoen423-e0196b370e8da38d366d327da57186dd3a44c2b2.zip
reliable multicast: periodically send acks
Diffstat (limited to 'src/main/java/derms/net/rmulticast/Announce.java')
-rw-r--r--src/main/java/derms/net/rmulticast/Announce.java48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/main/java/derms/net/rmulticast/Announce.java b/src/main/java/derms/net/rmulticast/Announce.java
deleted file mode 100644
index 41d72ed..0000000
--- a/src/main/java/derms/net/rmulticast/Announce.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package derms.net.rmulticast;
-
-import derms.net.ConcurrentMulticastSocket;
-import derms.net.Packet;
-import derms.util.Wait;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.time.Duration;
-import java.util.logging.Logger;
-
-/**
- * Periodically announce the presence of the local process to the group.
- * Allows processes to populate their set of group members, even if not
- * all members would normally send messages to the group.
- */
-class Announce implements Runnable {
- private static final Duration period = Duration.ofSeconds(30);
-
- private final DatagramPacket pkt;
- private final ConcurrentMulticastSocket outSock;
- private final Logger log;
-
- Announce(InetSocketAddress group, InetAddress laddr, ConcurrentMulticastSocket outSock) throws IOException {
- AnnounceMessage msg = new AnnounceMessage(laddr);
- this.pkt = Packet.encode(msg, group);
- this.outSock = outSock;
- this.log = Logger.getLogger(this.getClass().getName());
- }
-
- @Override
- public void run() {
- try {
- for (;;) {
- try {
- Wait.forDuration(period);
- outSock.send(pkt);
- } catch (IOException e) {
- log.warning(e.getMessage());
- }
- }
- } catch (InterruptedException e) {
- log.info("Announce thread interrupted: " + e.getMessage());
- }
- }
-}