mirror of
https://github.com/versity/versitygw.git
synced 2026-08-17 12:46:23 +00:00
WithOnListen registers a callback invoked once the server is bound and
ready to accept connections. It wraps fiber's existing OnListen hook,
which fires immediately before the first connection is served.
This allows callers to detect readiness deterministically rather than
relying on a fixed sleep or polling a health endpoint.
Example use in tests:
ready := make(chan struct{})
srv, _ := s3api.New(..., s3api.WithOnListen(func() { close(ready) }))
go srv.ServeMultiPort([]string{addr})
<-ready // blocks until the server is accepting connections