Skip to content
Snippets Groups Projects
Commit ee6f1e07 authored by ale's avatar ale
Browse files

remove the socket before creating it

parent 84a0f72b
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,10 @@ func newLocalServer(spoolPath string, serverUrl string, tlsConf *tls.Config) *lo
}
func (l *localServer) Serve(path string) error {
// Remove the UNIX socket, or we won't be able to bind successfully.
os.Remove(path)
// Bind to the specified UNIX socket.
uaddr, err := net.ResolveUnixAddr("unix", path)
if err != nil {
return err
......@@ -76,6 +80,7 @@ func (l *localServer) Serve(path string) error {
}
defer s.Close()
// Accept connections and handle them.
for {
conn, err := s.Accept()
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment