func (srv *Server) Close() error {
	err := srv.listener.Close()
	<-srv.done
	err = errors.Compose(err, srv.serveErr)
	err = errors.Compose(err, srv.node.Close())
	return errors.AddContext(err, "error while closing server")
}
Close closes the Server's listener, causing the HTTP server to shut down.
package server
import (
	"net"
	"net/http"
	"strings"
	"github.com/NebulousLabs/Sia/modules"
	"github.com/NebulousLabs/Sia/node"
	"github.com/NebulousLabs/Sia/node/api"
	"github.com/NebulousLabs/Sia/types"
	"github.com/NebulousLabs/errors"
)
type Server struct {
	api               *api.API
	apiServer         *http.Server
	done              chan struct{}
	listener          net.Listener
	node              *node.Node
	requiredUserAgent string
	serveErr          error
	Dir               string
}
func (srv *Server) serve() error {
	err := srv.apiServer.Serve(srv.listener)
	if err != nil && !strings.HasSuffix(err.Error(), "use of closed network connection") {
		return err
	}
	return nil
}