<commit_before>package gmqnet

import (
	"encoding/base64"
	"errors"
	"gmq/configuration"
	"gmq/queue"
	"net"
)

func HandleConnection(server *gmqconf.Server, params *gmqconf.Params) (err error) {
	//Init singletons
	output := make(chan []byte, params.Queue.MaxQueueN)
	queues := gmq.InitQueueInstance(params.Queue.MaxQueueN)

	for {
		conn, err := server.Listener.Accept()
		if err != nil {
			return err
		}
		go func(c net.Conn, params *gmqconf.Params, queues map[string]gmq.QueueInterface) {
			buf := make([]byte, params.Queue.MaxMessageL)
			n, err := c.Read(buf)
			if err != nil {
				c.Write([]byte("Error: " + err.Error()))
				c.Close()
			}
			output <- buf[:n]
			c.Write(handleMessage(params, <-output, queues))
			c.Close()
		}(conn, params, queues)
	}
	return nil
}

func handleMessage(params *gmqconf.Params, message []byte, queues map[string]gmq.QueueInterface) []byte {
	queue, err := gmqconf.ConfigureQueue(params)
	if err != nil {<commit_msg>Resolved singleton issue; check queue population<commit_after>package gmqnet

import (
	"encoding/base64"
	"errors"
	"gmq/configuration"
	"gmq/queue"
	"net"
)

func HandleConnection(server *gmqconf.Server, params *gmqconf.Params) (err error) {
	//Init singletons
	output := make(chan []byte, params.Queue.MaxQueueN)
	queues := gmq.InitQueueInstance(params.Queue.MaxQueueN)

	for {
		conn, err := server.Listener.Accept()
		if err != nil {
			return err
		}
		go func(c net.Conn, params *gmqconf.Params, q map[string]gmq.QueueInterface) {
			buf := make([]byte, params.Queue.MaxMessageL)
			n, err := c.Read(buf)
			if err != nil {
				c.Write([]byte("Error: " + err.Error()))
				c.Close()
			}
			output <- buf[:n]
			c.Write(handleMessage(params, <-output, q))
			c.Close()
		}(conn, params, queues)
	}
	return nil
}

func handleMessage(params *gmqconf.Params, message []byte, queues map[string]gmq.QueueInterface) []byte {
	queue, err := gmqconf.ConfigureQueue(params)
	if err != nil {
{'fraction_non_alphanumeric': 0.15633008713480268, 'fraction_numerical': 0.0020502306509482316, 'mean_word_length': 4.083333333333333, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2849047', 'n_tokens_mistral': 771, 'n_tokens_neox': 705, 'n_words': 157}