<commit_before>package moh

import (
	"log"
	"net"
	"net/http"
)

type MessagingServer struct {
	listener net.Listener
	Mux      *http.ServeMux
}

// NewClosableServer returns a pointer to a new ClosableServer.
// After creation, handlers can be registered on Mux and the server
// can be started with Serve() function. Then, you can close it with Close().
func NewClosableServer(addr string) (*MessagingServer, error) {
	l, err := net.Listen("tcp", addr)
	if err != nil {
		return nil, err
	}

	return &MessagingServer{
		listener: l,
		Mux:      http.NewServeMux(),
	}, nil
}

func (s *MessagingServer) Serve() {
	http.Serve(s.listener, s.Mux)
	log.Println("Serving has finished")
}

func (s *MessagingServer) Close() error {
	return s.listener.Close()
}<commit_msg>implement Addr method for MessagingServer<commit_after>package moh

import (
	"log"
	"net"
	"net/http"
)

type MessagingServer struct {
	listener net.Listener
	Mux      *http.ServeMux
}

// NewClosableServer returns a pointer to a new ClosableServer.
// After creation, handlers can be registered on Mux and the server
// can be started with Serve() function. Then, you can close it with Close().
func NewClosableServer(addr string) (*MessagingServer, error) {
	l, err := net.Listen("tcp", addr)
	if err != nil {
		return nil, err
	}

	return &MessagingServer{
		listener: l,
		Mux:      http.NewServeMux(),
	}, nil
}

func (s *MessagingServer) Serve() {
	http.Serve(s.listener, s.Mux)
	log.Println("Serving has finished")
}

func (s *MessagingServer) Close() error {
	return s.listener.Close()
}

func (s *MessagingServer) Addr() net.Addr {
	return s.listener.Addr()
}
{'fraction_non_alphanumeric': 0.12217470983506414, 'fraction_numerical': 0.0, 'mean_word_length': 3.978723404255319, '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': '394348', 'n_tokens_mistral': 591, 'n_tokens_neox': 567, 'n_words': 177}