<commit_before>package heartbeat

import (
	"net"
	"sync"
	"time"

	"github.com/bahadley/mgc/log"
)

var (
	send bool

	wg sync.WaitGroup
)

func Transmit() {
	addrs := DstAddr()

	// Counting semaphore set to the number of addrs.
	wg.Add(len(addrs))

	// Launch all threads.  Each thread has a different destination.
	for _, addr := range addrs {
		go egress(addr)
	}

	// Wait for the threads to finish.
	wg.Wait()
}

func egress(addr string) {
	dstAddr, err := net.ResolveUDPAddr("udp",
		addr+":"+DstPort())
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	srcAddr, err := net.ResolveUDPAddr("udp",
		Addr()+":0")
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	conn, err := net.DialUDP("udp", srcAddr, dstAddr)
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	defer conn.Close()
	defer wg.Done()

	hbs := NumHeartbeats()
	delayInt := DelayInterval()
	msg := []byte("alive")

	for i := 0; i < hbs; i++ {
		log.Trace.Printf("Tx(%s): %s", dstAddr, msg)

		if !send {
			continue
		}

		_, err = conn.Write(msg)
		if err != nil {
			log.Warning.Println(err.Error())
		}

		time.Sleep(delayInt * time.Millisecond)
	}
}

func init() {
	send = Send()
}
<commit_msg>Ensure delay interval is effective for no send executions<commit_after>package heartbeat

import (
	"net"
	"sync"
	"time"

	"github.com/bahadley/mgc/log"
)

var (
	send bool

	wg sync.WaitGroup
)

func Transmit() {
	addrs := DstAddr()

	// Counting semaphore set to the number of addrs.
	wg.Add(len(addrs))

	// Launch all threads.  Each thread has a different destination.
	for _, addr := range addrs {
		go egress(addr)
	}

	// Wait for the threads to finish.
	wg.Wait()
}

func egress(addr string) {
	dstAddr, err := net.ResolveUDPAddr("udp",
		addr+":"+DstPort())
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	srcAddr, err := net.ResolveUDPAddr("udp",
		Addr()+":0")
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	conn, err := net.DialUDP("udp", srcAddr, dstAddr)
	if err != nil {
		log.Error.Fatal(err.Error())
	}

	defer conn.Close()
	defer wg.Done()

	hbs := NumHeartbeats()
	delayInt := DelayInterval()
	msg := []byte("alive")

	for i := 0; i < hbs; i++ {
		log.Trace.Printf("Tx(%s): %s", dstAddr, msg)

		if send {
			_, err = conn.Write(msg)
			if err != nil {
				log.Warning.Println(err.Error())
			}
		}

		time.Sleep(delayInt * time.Millisecond)
	}
}

func init() {
	send = Send()
}

{'fraction_non_alphanumeric': 0.17225481978206203, 'fraction_numerical': 0.0016764459346186086, 'mean_word_length': 3.2473309608540926, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2441962', 'n_tokens_mistral': 1032, 'n_tokens_neox': 955, 'n_words': 227}