libos/LocalServer: Clean up socket file on exit
This doesn't work if the process is killed by an unhandled signal.
This commit is contained in:
parent
4cc8a44ec7
commit
bb6759986e
@ -136,6 +136,7 @@ namespace os
|
|||||||
~LocalServer();
|
~LocalServer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
StringView m_path;
|
||||||
int m_fd;
|
int m_fd;
|
||||||
bool m_blocking;
|
bool m_blocking;
|
||||||
};
|
};
|
||||||
|
@ -43,6 +43,7 @@ namespace os
|
|||||||
fcntl(sockfd, F_SETFD, FD_CLOEXEC);
|
fcntl(sockfd, F_SETFD, FD_CLOEXEC);
|
||||||
|
|
||||||
server->m_fd = sockfd;
|
server->m_fd = sockfd;
|
||||||
|
server->m_path = path;
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +64,7 @@ namespace os
|
|||||||
LocalServer::~LocalServer()
|
LocalServer::~LocalServer()
|
||||||
{
|
{
|
||||||
close(m_fd);
|
close(m_fd);
|
||||||
|
os::FileSystem::remove(m_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalServer::Client::Client(Client&& other) : m_fd(other.m_fd)
|
LocalServer::Client::Client(Client&& other) : m_fd(other.m_fd)
|
||||||
|
Loading…
Reference in New Issue
Block a user