From e183f9cd23380a81071c32f64c91e60f46a7d8cb Mon Sep 17 00:00:00 2001 From: tjpcc Date: Wed, 11 Jan 2023 10:36:56 -0700 Subject: lots more documentation comments --- gemini/serve.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gemini/serve.go') diff --git a/gemini/serve.go b/gemini/serve.go index abf127e..f9a8a1c 100644 --- a/gemini/serve.go +++ b/gemini/serve.go @@ -8,6 +8,7 @@ import ( "sync" ) +// Server listens on a network and serves the gemini protocol. type Server struct { ctx context.Context network string @@ -18,6 +19,7 @@ type Server struct { handler Handler } +// NewServer builds a server. func NewServer( ctx context.Context, tlsConfig *tls.Config, @@ -46,6 +48,10 @@ func NewServer( // // This function will allocate resources which are not cleaned up until // Close() is called. +// +// It will respect cancellation of the context the server was created with, +// but be aware that Close() must still be called in that case to avoid +// dangling goroutines. func (s *Server) Serve() error { s.wg.Add(1) defer s.wg.Done() -- cgit v1.2.3