<commit_before>package httpd

import (
	"bufio"
	"fmt"
	"github.com/Symantec/Dominator/sub/scanner"
	"io"
	"net"
	"net/http"
	"net/rpc"
)

type HtmlWriter interface {
	WriteHtml(writer io.Writer)
}

var onlyHtmler HtmlWriter
var onlyFsh *scanner.FileSystemHistory

type Subd int

func (t *Subd) Poll(generation uint64, reply *scanner.FileSystem) error {
	if onlyFsh.FileSystem() != nil {
		*reply = *onlyFsh.FileSystem()
	}
	return nil
}

func StartServer(portNum uint, fsh *scanner.FileSystemHistory) error {
	listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
	if err != nil {
		return err
	}
	onlyHtmler = fsh<commit_msg>Check generation count in subd.Poll() RPC.<commit_after>package httpd

import (
	"bufio"
	"fmt"
	"github.com/Symantec/Dominator/sub/scanner"
	"io"
	"net"
	"net/http"
	"net/rpc"
)

type HtmlWriter interface {
	WriteHtml(writer io.Writer)
}

var onlyHtmler HtmlWriter
var onlyFsh *scanner.FileSystemHistory

type Subd int

func (t *Subd) Poll(generation uint64, reply *scanner.FileSystem) error {
	fs := onlyFsh.FileSystem()
	if fs != nil && generation != onlyFsh.GenerationCount() {
		*reply = *fs
	}
	return nil
}

func StartServer(portNum uint, fsh *scanner.FileSystemHistory) error {
	listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
	if err != nil {
		return err
	}
	onlyHtmler = fsh
{'fraction_non_alphanumeric': 0.13303437967115098, 'fraction_numerical': 0.0029895366218236174, 'mean_word_length': 4.579166666666667, 'pattern_counts': {'":': 2, '<': 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': '3345005', 'n_tokens_mistral': 521, 'n_tokens_neox': 511, 'n_words': 122}