event/SocketMonitor: use class SocketDescriptor
This commit is contained in:
@@ -185,7 +185,8 @@ HttpdClient::SendResponse()
|
||||
return true;
|
||||
}
|
||||
|
||||
HttpdClient::HttpdClient(HttpdOutput &_httpd, int _fd, EventLoop &_loop,
|
||||
HttpdClient::HttpdClient(HttpdOutput &_httpd, SocketDescriptor _fd,
|
||||
EventLoop &_loop,
|
||||
bool _metadata_supported)
|
||||
:BufferedSocket(_fd, _loop),
|
||||
httpd(_httpd),
|
||||
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
* @param httpd the HTTP output device
|
||||
* @param _fd the socket file descriptor
|
||||
*/
|
||||
HttpdClient(HttpdOutput &httpd, int _fd, EventLoop &_loop,
|
||||
HttpdClient(HttpdOutput &httpd, SocketDescriptor _fd, EventLoop &_loop,
|
||||
bool _metadata_supported);
|
||||
|
||||
/**
|
||||
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
return HasClients();
|
||||
}
|
||||
|
||||
void AddClient(int fd);
|
||||
void AddClient(SocketDescriptor fd);
|
||||
|
||||
/**
|
||||
* Removes a client from the httpd_output.clients linked list.
|
||||
|
||||
@@ -118,7 +118,7 @@ HttpdOutput::Unbind()
|
||||
* HttpdOutput.clients linked list.
|
||||
*/
|
||||
inline void
|
||||
HttpdOutput::AddClient(int fd)
|
||||
HttpdOutput::AddClient(SocketDescriptor fd)
|
||||
{
|
||||
auto *client = new HttpdClient(*this, fd, GetEventLoop(),
|
||||
!encoder->ImplementsTag());
|
||||
@@ -184,7 +184,7 @@ HttpdOutput::OnAccept(int fd, SocketAddress address, gcc_unused int uid)
|
||||
|
||||
/* can we allow additional client */
|
||||
if (open && (clients_max == 0 || clients.size() < clients_max))
|
||||
AddClient(fd);
|
||||
AddClient(SocketDescriptor(fd));
|
||||
else
|
||||
close_socket(fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user