package herd

import (
	"fmt"
	"net"
	"net/http"
)

var httpdHerd *Herd

func (herd *Herd) startServer(portNum uint, daemon bool) error {
	listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
	if err != nil {
		return err
	}
	httpdHerd = herd
	http.HandleFunc("/", statusHandler)
	http.HandleFunc("/listSubs", listSubsHandler)
	http.HandleFunc("/showSubs", showAllSubsHandler)
	http.HandleFunc("/showDeviantSubs", showDeviantSubsHandler)
	http.HandleFunc("/showCompliantSubs", showCompliantSubsHandler)
	if daemon {
		go http.Serve(listener, nil)
	} else {
		http.Serve(listener, nil)
	}
	return nil
}

func (herd *Herd) addHtmlWriter(htmlWriter HtmlWriter) {
	herd.htmlWriters = append(herd.htmlWriters, htmlWriter)
}

package herd

import (
	"fmt"
	"net"
	"net/http"
)

var httpdHerd *Herd

func (herd *Herd) startServer(portNum uint, daemon bool) error {
	listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
	if err != nil {
		return err
	}
	httpdHerd = herd
	http.HandleFunc("/", statusHandler)
	http.HandleFunc("/listSubs", listSubsHandler)
	http.HandleFunc("/showAllSubs", showAllSubsHandler)
	http.HandleFunc("/showDeviantSubs", showDeviantSubsHandler)
	http.HandleFunc("/showCompliantSubs", showCompliantSubsHandler)
	if daemon {
		go http.Serve(listener, nil)
	} else {
		http.Serve(listener, nil)
	}
	return nil
}

func (herd *Herd) addHtmlWriter(htmlWriter HtmlWriter) {
	herd.htmlWriters = append(herd.htmlWriters, htmlWriter)
}

Fix bug: list of all subs did not work.
Fix bug: list of all subs did not work.

Bug introduced in commit 08c68b5a85bc9ab42391c6b3bb65942d4c9dce6b.
