mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
fix socket remove
This commit is contained in:
parent
3744994ea8
commit
ec0ca59539
|
|
@ -20,9 +20,11 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"embed"
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
|
|
@ -435,8 +437,8 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if externalHTTPAddr.IsUnixSocket() {
|
if externalHTTPAddr.IsUnixSocket() {
|
||||||
err := os.RemoveAll(externalHTTPAddr.Address)
|
err := os.Remove(externalHTTPAddr.Address)
|
||||||
if err != nil {
|
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||||
logrus.WithError(err).Fatal("failed to remove existing unix socket")
|
logrus.WithError(err).Fatal("failed to remove existing unix socket")
|
||||||
}
|
}
|
||||||
listener, err := net.Listen(externalHTTPAddr.Network(), externalHTTPAddr.Address)
|
listener, err := net.Listen(externalHTTPAddr.Network(), externalHTTPAddr.Address)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue