diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-01-11 10:36:56 -0700 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-01-11 10:36:56 -0700 |
commit | e183f9cd23380a81071c32f64c91e60f46a7d8cb (patch) | |
tree | d78b0a4936dee3e3201d97668bfb5de4492b3593 /gemini/serve.go | |
parent | 197d8e4cb0170356dd20755efcf1d336c4c38583 (diff) |
lots more documentation comments
Diffstat (limited to 'gemini/serve.go')
-rw-r--r-- | gemini/serve.go | 6 |
1 files changed, 6 insertions, 0 deletions
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() |