Beispiel #1
0
// ListenAndServe starts the the discoverd agent.
func ListenAndServe(server *Agent) error {
	rpc.HandleHTTP()
	if err := rpc.Register(server); err != nil {
		return err
	}
	return http.ListenAndServe(server.Address, nil)
}
Beispiel #2
0
func serveHTTP(host *Host, attach *attachHandler, sh *shutdownHandler) error {
	if err := rpc.Register(host); err != nil {
		return err
	}
	rpc.HandleHTTP()
	http.Handle("/attach", attach)

	l, err := net.Listen("tcp", ":1113")
	if err != nil {
		return err
	}
	sh.BeforeExit(func() { l.Close() })
	go http.Serve(l, nil)
	return nil
}
Beispiel #3
0
func serveHTTP(host *Host, attach *attachHandler) {
	rpc.Register(host)
	rpc.HandleHTTP()
	http.Handle("/attach", attach)
	http.ListenAndServe(":1113", nil)
}