<commit_before>package wemdigo

import (
	"sync"
	"time"

	"github.com/gorilla/websocket"
)

type Link struct {
	ws    *websocket.Conn // Underlying Gorilla websocket connection.
	wg    sync.WaitGroup
	id    string        // Peer identifier for the websocket.
	peers cmap          // List of other connections the socket can talk to.
	send  chan *Message // Messages to write to the websocket.
	close chan struct{} // To tell the write loop it is finished.
	mid   *Middle       // Middle instance to which the Link belongs.
}

func (l *Link) setReadDeadline() {
	var t time.Time
	if l.mid.conf.pongWait != 0 {
		t = time.Now().Add(l.mid.conf.pongWait)
	}
	l.ws.SetReadDeadline(t)
}

// Initialize the set of peers.
func (l *Link) setPeers(ps []string) {
	l.peers = cmap{
		m: make(map[string]*Link),
	}

	if len(ps) == 0 {
		// Set the peer list to every other connection.<commit_msg>Address linter warnings.<commit_after>package wemdigo

import (
	"sync"
	"time"

	"github.com/gorilla/websocket"
)

// Link instances wrap a Gorilla websocket and provide a link to
// a specific Middle instance.  The Link is responsible for keeping
// the underlying websocket connection alive as well as reading / writing
// messages.
type Link struct {
	ws    *websocket.Conn // Underlying Gorilla websocket connection.
	wg    sync.WaitGroup
	id    string        // Peer identifier for the websocket.
	peers cmap          // List of other connections the socket can talk to.
	send  chan *Message // Messages to write to the websocket.
	close chan struct{} // To tell the write loop it is finished.
	mid   *Middle       // Middle instance to which the Link belongs.
}

func (l *Link) setReadDeadline() {
	var t time.Time
	if l.mid.conf.pongWait != 0 {
		t = time.Now().Add(l.mid.conf.pongWait)
	}
	l.ws.SetReadDeadline(t)
}

// Initialize the set of peers.
func (l *Link) setPeers(ps []string) {
	l.peers = cmap{
		m: make(map[string]*Link),
	}

	if len(ps) == 0 {
		// Set the peer list to every other connection.
{'fraction_non_alphanumeric': 0.10605302651325663, 'fraction_numerical': 0.002001000500250125, 'mean_word_length': 2.9292730844793713, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6548012', 'n_tokens_mistral': 684, 'n_tokens_neox': 655, 'n_words': 237}