Esempio n. 1
0
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
}
Esempio n. 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
}
Esempio n. 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
}