<commit_before>package main

import (
	"encoding/json"
	log "github.com/Sirupsen/logrus"
	"golang.org/x/net/websocket"
	"net"
)

func dialWave(wave_host string) net.Conn {
	// discard frames while dialing every 5 seconds until success
	endpoint := endpoint_uri(wave_host)
	origin := origin_uri(wave_host)
	log.WithFields(log.Fields{
		"wave_host": wave_host,
	}).Info("dialing Wave")
	ws, err := websocket.Dial(endpoint, "", origin)
	if err != nil {
		log.WithFields(log.Fields{
			"error":     err,
			"wave_host": wave_host,
		}).Error("failed to dial wave")
		//discardUntil(, frames)
	} else {
		log.WithFields(log.Fields{
			"wave_host": wave_host,
		}).Info("success dialing Wave, sending frames")
	}
	return ws

}

func discardUntil(done chan bool, channel chan Wireless80211Frame) {

}

func rateLimit(frame Wireless80211Frame) bool {
	if frame.Type == "MgmtBeacon" {
		return true // only send an exact match for some beacon properties every second
	}
	return false
}<commit_msg>add small utility to discard channel writes<commit_after>package main

import (
	"encoding/json"
	log "github.com/Sirupsen/logrus"
	"golang.org/x/net/websocket"
	"net"
)

func dialWave(wave_host string) net.Conn {
	// discard frames while dialing every 5 seconds until success
	endpoint := endpoint_uri(wave_host)
	origin := origin_uri(wave_host)
	log.WithFields(log.Fields{
		"wave_host": wave_host,
	}).Info("dialing Wave")
	ws, err := websocket.Dial(endpoint, "", origin)
	if err != nil {
		log.WithFields(log.Fields{
			"error":     err,
			"wave_host": wave_host,
		}).Error("failed to dial wave")
		//discardUntil(, frames)
	} else {
		log.WithFields(log.Fields{
			"wave_host": wave_host,
		}).Info("success dialing Wave, sending frames")
	}
	return ws

}

func discardUntil(done chan bool, channel chan Wireless80211Frame) {
	for {
		select {
		case _ = <-done:
			return
		case _ = <-channel:
		}
	}

}

func rateLimit(frame Wireless80211Frame) bool {
	if frame.Type == "MgmtBeacon" {
		return true // only send an exact match for some beacon properties every second
	}
	return false
}
{'fraction_non_alphanumeric': 0.12584053794428435, 'fraction_numerical': 0.010566762728146013, 'mean_word_length': 4.117936117936118, 'pattern_counts': {'":': 8, '<': 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': '5943167', 'n_tokens_mistral': 797, 'n_tokens_neox': 710, 'n_words': 189}