<commit_before>package gumble

import (
	"encoding/binary"
	"errors"
	"io"
)

const maximumPacketLength = 1024 * 1024 * 10 // 10 megabytes

var (
	errInvalidArgument  = errors.New("invalid argument passed to function")
	errPacketReadType   = errors.New("could not read packet type")
	errPacketReadLength = errors.New("could not read packet length")
	errPacketLength     = errors.New("packet data is too large")
	errPacketRead       = errors.New("packet read error")
)

// serverIncoming reads protobuffer messages from the server.
func clientIncoming(client *Client) {
	defer client.Close()

	conn := client.connection

	for {
    var pType uint16
    var pLength uint32

    if err := binary.Read(conn, binary.BigEndian, &pType); err != nil {
      return
    }
    if err := binary.Read(conn, binary.BigEndian, &pLength); err != nil {
      return
    }
    pLengthInt := int(pLength)
    if pLengthInt > maximumPacketLength {
      return
    }
    data := make([]byte, pLengthInt)
    if _, err := io.ReadFull(conn, data); err != nil {
      return
    }
    if handle, ok := handlers[pType]; ok {
      if err := handle(client, data); err != nil {
        // TODO: log error?
      }
    }
	}
}
<commit_msg>format client_incoming.go<commit_after>package gumble

import (
	"encoding/binary"
	"errors"
	"io"
)

const maximumPacketLength = 1024 * 1024 * 10 // 10 megabytes

var (
	errInvalidArgument  = errors.New("invalid argument passed to function")
	errPacketReadType   = errors.New("could not read packet type")
	errPacketReadLength = errors.New("could not read packet length")
	errPacketLength     = errors.New("packet data is too large")
	errPacketRead       = errors.New("packet read error")
)

// serverIncoming reads protobuffer messages from the server.
func clientIncoming(client *Client) {
	defer client.Close()

	conn := client.connection

	for {
		var pType uint16
		var pLength uint32

		if err := binary.Read(conn, binary.BigEndian, &pType); err != nil {
			return
		}
		if err := binary.Read(conn, binary.BigEndian, &pLength); err != nil {
			return
		}
		pLengthInt := int(pLength)
		if pLengthInt > maximumPacketLength {
			return
		}
		data := make([]byte, pLengthInt)
		if _, err := io.ReadFull(conn, data); err != nil {
			return
		}
		if handle, ok := handlers[pType]; ok {
			if err := handle(client, data); err != nil {
				// TODO: log error?
			}
		}
	}
}

{'fraction_non_alphanumeric': 0.11860854987426656, 'fraction_numerical': 0.013411567476948869, 'mean_word_length': 3.224778761061947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2835756', 'n_tokens_mistral': 820, 'n_tokens_neox': 756, 'n_words': 219}