示例#1
0
文件: policy.go 项目: simonz05/policy
func ListenAndServe(laddr string) error {
	l, err := net.Listen("tcp", laddr)

	if err != nil {
		return err
	}

	log.Printf("Listen on %s", l.Addr())
	sig.TrapCloser(l)
	err = serve(l)
	log.Printf("Shutting down ..")
	return err
}
示例#2
0
func ListenAndServe(conf *config.Config) error {
	setupServer(conf)

	l, err := net.Listen("tcp", conf.Listen)

	if err != nil {
		return err
	}

	log.Printf("Listen on %s", l.Addr())

	sig.TrapCloser(l)
	err = http.Serve(l, nil)
	log.Print("Shutting down ..")
	return err
}
示例#3
0
func ListenAndServe(laddr string, storage blobserver.Storage) error {
	if err := setupServer(storage); err != nil {
		return err
	}

	l, err := net.Listen("tcp", laddr)

	if err != nil {
		return err
	}

	log.Printf("Listen on %s", l.Addr())

	sig.TrapCloser(l)
	err = http.Serve(l, nil)
	log.Printf("Shutting down ..")
	return err
}