// 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) }
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 }
func serveHTTP(host *Host, attach *attachHandler) { rpc.Register(host) rpc.HandleHTTP() http.Handle("/attach", attach) http.ListenAndServe(":1113", nil) }