<commit_before>package main

// Listen for clients, interpret requests
// and execute specified command
// in our optimization context.

import (
	"bufio"
	"fmt"
	"log"
	"net"
	"os"
	"strconv"
	"strings"
)

const SOCKET_PATH = "/tmp/ipcd.sock"

type ClientReq struct {
	I int
}

const (
	REQ_ERR_UNRECOGNIZED_CMD  = iota
	REQ_ERR_INVALID_PARAMETER = iota
	REQ_ERR_INSUFFICIENT_ARGS = iota
	REQ_ERR_UNKNOWN           = iota
)

type ReqError struct {
	Type int
	Msg  string
}

func (R *ReqError) Error() string {
	return fmt.Sprintf("RequestError(Type=%d, Msg=%s)", R.Type, R.Msg)
}

func (R *ReqError) Response() string {
	ErrCode := 300 + R.Type
	return fmt.Sprintf("%d %s", ErrCode, R.Msg)
}

func listenForClients(C *IPCContext) {
	os.Remove(SOCKET_PATH)
	ln, err := net.Listen("unix", SOCKET_PATH)
	if err != nil {
		panic(err)
	}

	for {
		conn, err := ln.Accept()
		if err != nil {
			log.Printf("Error in accept: %s\n", err.Error())
			continue
		}
		go handleConnection(C, conn)
	}
}<commit_msg>Modify permissions on socket to ipcd so all can access.<commit_after>package main

// Listen for clients, interpret requests
// and execute specified command
// in our optimization context.

import (
	"bufio"
	"fmt"
	"log"
	"net"
	"os"
	"strconv"
	"strings"
)

const SOCKET_PATH = "/tmp/ipcd.sock"

type ClientReq struct {
	I int
}

const (
	REQ_ERR_UNRECOGNIZED_CMD  = iota
	REQ_ERR_INVALID_PARAMETER = iota
	REQ_ERR_INSUFFICIENT_ARGS = iota
	REQ_ERR_UNKNOWN           = iota
)

type ReqError struct {
	Type int
	Msg  string
}

func (R *ReqError) Error() string {
	return fmt.Sprintf("RequestError(Type=%d, Msg=%s)", R.Type, R.Msg)
}

func (R *ReqError) Response() string {
	ErrCode := 300 + R.Type
	return fmt.Sprintf("%d %s", ErrCode, R.Msg)
}

func listenForClients(C *IPCContext) {
	os.Remove(SOCKET_PATH)
	ln, err := net.Listen("unix", SOCKET_PATH)
	if err != nil {
		panic(err)
	}

	err = os.Chmod(SOCKET_PATH, os.ModePerm)
	if err != nil {
		panic(err)
	}

	for {
		conn, err := ln.Accept()
		if err != nil {
			log.Printf("Error in accept: %s\n", err.Error())
			continue
		}
		go handleConnection(C, conn)
	}
}
{'fraction_non_alphanumeric': 0.1352497643732328, 'fraction_numerical': 0.002827521206409048, 'mean_word_length': 3.6353711790393013, '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': '2705846', 'n_tokens_mistral': 861, 'n_tokens_neox': 843, 'n_words': 212}