<commit_before>package land

import (
	"github.com/Nyarum/noterius/core"

	"io"
	"log"
	"net"
)

// Application struct for project and his variables
type Application struct {
	Config       core.Config
	Database     core.Database
	ErrorHandler func(c net.Conn)
}

// Run function for starting server
func (a *Application) Run() (err error) {
	listen, err := net.Listen("tcp", a.Config.Base.IP+":"+a.Config.Base.Port)
	if err != nil {
		return
	}

	for {
		client, err := listen.Accept()
		if err != nil {
			log.Println(err)
			continue
		}

		go func(c net.Conn, conf core.Config) {
			defer a.ErrorHandler(c)

			log.Println("Client is connected:", c.RemoteAddr())

			var (
				bytesAlloc      []byte      = make([]byte, conf.Option.LenBuffer)
				readBytesSocket chan string = make(chan string)
			)

			go ClientLive(c, readBytesSocket, conf)

			for {
				if _, err := c.Read(bytesAlloc); err == io.EOF {
					log.Printf("Client [%v] is disconnected\n", c.RemoteAddr())
					break
				} else if err != nil {
					log.Printf("Client [%v] is error read packet, err - %v\n", c.RemoteAddr(), err)
				}

				readBytesSocket <- string(bytesAlloc)
			}
		}(client, a.Config)
	}
}<commit_msg>Add defer for close channel<commit_after>package land

import (
	"github.com/Nyarum/noterius/core"

	"io"
	"log"
	"net"
)

// Application struct for project and his variables
type Application struct {
	Config       core.Config
	Database     core.Database
	ErrorHandler func(c net.Conn)
}

// Run function for starting server
func (a *Application) Run() (err error) {
	listen, err := net.Listen("tcp", a.Config.Base.IP+":"+a.Config.Base.Port)
	if err != nil {
		return
	}

	for {
		client, err := listen.Accept()
		if err != nil {
			log.Println(err)
			continue
		}

		go func(c net.Conn, conf core.Config) {
			defer a.ErrorHandler(c)

			log.Println("Client is connected:", c.RemoteAddr())

			var (
				bytesAlloc      []byte      = make([]byte, conf.Option.LenBuffer)
				readBytesSocket chan string = make(chan string)
			)
			defer close(readBytesSocket)

			go ClientLive(c, readBytesSocket, conf)

			for {
				if _, err := c.Read(bytesAlloc); err == io.EOF {
					log.Printf("Client [%v] is disconnected\n", c.RemoteAddr())
					break
				} else if err != nil {
					log.Printf("Client [%v] is error read packet, err - %v\n", c.RemoteAddr(), err)
				}

				readBytesSocket <- string(bytesAlloc)
			}
		}(client, a.Config)
	}
}
{'fraction_non_alphanumeric': 0.14179719703215168, 'fraction_numerical': 0.0, 'mean_word_length': 2.9786885245901638, 'pattern_counts': {'":': 2, '<': 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': '1918460', 'n_tokens_mistral': 955, 'n_tokens_neox': 824, 'n_words': 220}