Remove another Dlist.
This commit is contained in:
+6
-9
@@ -114,7 +114,7 @@ static const char *File_content_type(const char *filename);
|
||||
static int DPIBYE = 0;
|
||||
static int OLD_STYLE = 0;
|
||||
/* A list for the clients we are serving */
|
||||
static Dlist *Clients;
|
||||
static std::vector< ClientInfo * > Clients;
|
||||
/* Set of filedescriptors we're working on */
|
||||
fd_set read_set, write_set;
|
||||
|
||||
@@ -905,7 +905,7 @@ static ClientInfo *File_add_client(int sock_fd)
|
||||
new_client->flags = FILE_READ;
|
||||
new_client->old_style = OLD_STYLE;
|
||||
|
||||
dList_append(Clients, new_client);
|
||||
Clients.push_back( new_client );
|
||||
|
||||
return new_client;
|
||||
}
|
||||
@@ -915,7 +915,7 @@ static ClientInfo *File_add_client(int sock_fd)
|
||||
*/
|
||||
static void File_remove_client(ClientInfo *client)
|
||||
{
|
||||
dList_remove(Clients, (void *)client);
|
||||
Clients.erase( std::find( begin( Clients ), end( Clients ), client ) );
|
||||
|
||||
_MSG("Closing Socket Handler\n");
|
||||
a_Dpip_dsh_close(client->sh);
|
||||
@@ -1007,7 +1007,7 @@ static void File_serve_clients(void)
|
||||
int i, f_read, f_write;
|
||||
ClientInfo *client;
|
||||
|
||||
for (i = 0; (client = reinterpret_cast< ClientInfo * >( dList_nth_data(Clients, i) )); ++i) {
|
||||
for (i = 0; (client = Clients.at( i ) ); ++i) {
|
||||
f_read = FD_ISSET(client->sh->fd_in, &read_set);
|
||||
f_write = FD_ISSET(client->sh->fd_out, &write_set);
|
||||
if (!f_read && !f_write)
|
||||
@@ -1036,13 +1036,13 @@ static int File_check_fds(uint_t seconds)
|
||||
FD_ZERO (&read_set);
|
||||
FD_ZERO (&write_set);
|
||||
FD_SET (STDIN_FILENO, &read_set);
|
||||
for (i = 0; (client = reinterpret_cast< ClientInfo * >( dList_nth_data(Clients, i) )); ++i) {
|
||||
for (i = 0; (client = Clients.at( i )); ++i) {
|
||||
if (client->flags & FILE_READ)
|
||||
FD_SET (client->sh->fd_in, &read_set);
|
||||
if (client->flags & FILE_WRITE)
|
||||
FD_SET (client->sh->fd_out, &write_set);
|
||||
}
|
||||
_MSG("Watching %d fds\n", dList_length(Clients) + 1);
|
||||
_MSG("Watching %d fds\n", Clients.size() + 1);
|
||||
|
||||
/* Initialize the timeout data structure. */
|
||||
timeout.tv_sec = seconds;
|
||||
@@ -1091,9 +1091,6 @@ int main(void)
|
||||
/* Set STDIN socket nonblocking (to ensure accept() never blocks) */
|
||||
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK | fcntl(STDIN_FILENO, F_GETFL));
|
||||
|
||||
/* initialize Clients list */
|
||||
Clients = dList_new(512);
|
||||
|
||||
/* some OSes may need this... */
|
||||
sin_sz = sizeof(sin);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user