internal/server/tcp.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | package server import ( "net" "website/internal/listenfd" "website/internal/log" "github.com/pkg/errors" ) func (s *Server) serveTCP() error { l, err := listenfd.GetListener(0) if err != nil { log.Warn("could not create listener from listenfd", "error", err) } log.Debug("listener from listenfd?", "passed", l != nil) if l == nil { l, err = net.Listen("tcp", s.Addr) if err != nil { return errors.Wrap(err, "could not create listener") } } return s.Serve(l) } |