about summary refs log tree commit diff stats
path: root/internal/server/tcp.go
blob: 1d57c9c398d22b14316a53a5f3ef59aaafea138b (plain)
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.runtimeConfig.ListenAddress, strconv.Itoa(s.runtimeConfig.Port)),
		s.log.Named("tcp.listenfd"),
	)
	if err != nil {
		return err
	}

	return s.Serve(l)
}