event/ServerSocket: pass UniqueSocketDescriptor by value
Passing it by value is actually smaller (32 bit) than the rvalue reference (64 bit pointer), and it ensures that the object is consumed after the call returns, no matter how the methods are implemented.
This commit is contained in:
@@ -186,7 +186,7 @@ HttpdClient::SendResponse()
|
||||
return true;
|
||||
}
|
||||
|
||||
HttpdClient::HttpdClient(HttpdOutput &_httpd, UniqueSocketDescriptor &&_fd,
|
||||
HttpdClient::HttpdClient(HttpdOutput &_httpd, UniqueSocketDescriptor _fd,
|
||||
EventLoop &_loop,
|
||||
bool _metadata_supported)
|
||||
:BufferedSocket(_fd.Release(), _loop),
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
* @param httpd the HTTP output device
|
||||
* @param _fd the socket file descriptor
|
||||
*/
|
||||
HttpdClient(HttpdOutput &httpd, UniqueSocketDescriptor &&_fd,
|
||||
HttpdClient(HttpdOutput &httpd, UniqueSocketDescriptor _fd,
|
||||
EventLoop &_loop,
|
||||
bool _metadata_supported);
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
return HasClients();
|
||||
}
|
||||
|
||||
void AddClient(UniqueSocketDescriptor &&fd);
|
||||
void AddClient(UniqueSocketDescriptor fd);
|
||||
|
||||
/**
|
||||
* Removes a client from the httpd_output.clients linked list.
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
private:
|
||||
virtual void RunDeferred() override;
|
||||
|
||||
void OnAccept(UniqueSocketDescriptor &&fd,
|
||||
void OnAccept(UniqueSocketDescriptor fd,
|
||||
SocketAddress address, int uid) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ HttpdOutput::Unbind()
|
||||
* HttpdOutput.clients linked list.
|
||||
*/
|
||||
inline void
|
||||
HttpdOutput::AddClient(UniqueSocketDescriptor &&fd)
|
||||
HttpdOutput::AddClient(UniqueSocketDescriptor fd)
|
||||
{
|
||||
auto *client = new HttpdClient(*this, std::move(fd), GetEventLoop(),
|
||||
!encoder->ImplementsTag());
|
||||
@@ -151,7 +151,7 @@ HttpdOutput::RunDeferred()
|
||||
}
|
||||
|
||||
void
|
||||
HttpdOutput::OnAccept(UniqueSocketDescriptor &&fd,
|
||||
HttpdOutput::OnAccept(UniqueSocketDescriptor fd,
|
||||
SocketAddress address, gcc_unused int uid)
|
||||
{
|
||||
/* the listener socket has become readable - a client has
|
||||
|
||||
Reference in New Issue
Block a user