mirror of
https://github.com/netbirdio/netbird.git
synced 2025-01-19 04:19:48 +01:00
Use mux for http server
Without it can not start multiple http server instances for unit tests
This commit is contained in:
parent
6d627f1923
commit
7cc3964a4d
@ -36,10 +36,12 @@ func NewListener(address string) listener.Listener {
|
||||
// Listen todo: prevent multiple call
|
||||
func (l *Listener) Listen(acceptFn func(conn net.Conn)) error {
|
||||
l.acceptFn = acceptFn
|
||||
http.HandleFunc("/", l.onAccept)
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", l.onAccept)
|
||||
|
||||
l.server = &http.Server{
|
||||
Addr: l.address,
|
||||
Addr: l.address,
|
||||
Handler: mux,
|
||||
}
|
||||
|
||||
log.Infof("WS server is listening on address: %s", l.address)
|
||||
|
Loading…
Reference in New Issue
Block a user