<commit_before>package main

import (
	"encoding/json"
	"golang.org/x/net/websocket"
	"io"
	"log"
	"net/http"
	"time"
)

type SettingMessage struct {
	Setting string `json:"setting"`
	Value   bool   `json:"state"`
}

func statusSender(conn *websocket.Conn) {
	timer := time.NewTicker(1 * time.Second)
	for {
		<-timer.C

		statResp, _ := json.Marshal(&globalStatus)
		conn.Write(statResp)

		settingResp, _ := json.Marshal(&globalSettings)
		_, err := conn.Write(settingResp)

		if err != nil {
//			log.Printf("Web client disconnected.\n")
			break
		}
	}
}

func handleManagementConnection(conn *websocket.Conn) {
//	log.Printf("Web client connected.\n")
	go statusSender(conn)

	for {
		var msg SettingMessage
		err := websocket.JSON.Receive(conn, &msg)
		if err == io.EOF {<commit_msg>AHRS LED error.<commit_after>package main

import (
	"encoding/json"
	"golang.org/x/net/websocket"
	"io"
	"log"
	"net/http"
	"time"
)

type SettingMessage struct {
	Setting string `json:"setting"`
	Value   bool   `json:"state"`
}

type InfoMessage struct {
	*status
	*settings
}

func statusSender(conn *websocket.Conn) {
	timer := time.NewTicker(1 * time.Second)
	for {
		<-timer.C

		update, _ := json.Marshal(InfoMessage{status:&globalStatus, settings:&globalSettings})
		_, err := conn.Write(update)

		if err != nil {
//			log.Printf("Web client disconnected.\n")
			break
		}
	}
}

func handleManagementConnection(conn *websocket.Conn) {
//	log.Printf("Web client connected.\n")
	go statusSender(conn)

	for {
		var msg SettingMessage
		err := websocket.JSON.Receive(conn, &msg)
		if err == io.EOF {
{'fraction_non_alphanumeric': 0.14868255959849436, 'fraction_numerical': 0.0012547051442910915, 'mean_word_length': 3.8776758409785934, 'pattern_counts': {'":': 0, '<': 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': '7191817', 'n_tokens_mistral': 619, 'n_tokens_neox': 569, 'n_words': 121}