all repos — website @ 99f8047ef20a64f948ac2b703c81eb49bed091c0

My website

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
package server

import (
	"net"
	"strconv"

	"go.alanpearce.eu/x/listenfd"
)

func (s *Server) serveTCP() error {
	l, err := listenfd.GetListener(0,
		net.JoinHostPort(s.options.ListenAddress, strconv.Itoa(s.options.Port)),
		s.log.Named("tcp.listenfd"),
	)
	if err != nil {
		return err
	}

	return s.server.Serve(l)
}