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

	return s.server.Serve(l)
}