outgoing/worker: classify read-only clients to their own list

This commit is contained in:
Heikki Hannikainen 2012-10-12 02:33:46 +03:00
parent 18b7dc4320
commit 9cb21af856
3 changed files with 7 additions and 8 deletions

View File

@ -92,12 +92,6 @@ static void process_outgoing_single(struct worker_t *self, struct pbuf_t *pb)
continue;
}
/* Do not send to read-only sockets */
if (c->flags & CLFLAGS_PORT_RO) {
//hlog(LOG_DEBUG, "%d/%s: not sending to client: read-only socket", c->fd, c->username);
continue;
}
/* Do not send packet back to the source client.
This may reject a packet that came from a socket that got
closed a few milliseconds ago and its client_t got

View File

@ -1289,7 +1289,11 @@ static void collect_new_clients(struct worker_t *self)
struct client_t *class_next;
struct client_t **class_prevp;
if (c->flags & CLFLAGS_DUPEFEED) {
if (c->flags & CLFLAGS_PORT_RO) {
hlog(LOG_DEBUG, "collect_new_clients(worker %d): client fd %d classified readonly", self->id, c->fd);
class_next = self->clients_ro;
class_prevp = &self->clients_ro;
} else if (c->flags & CLFLAGS_DUPEFEED) {
hlog(LOG_DEBUG, "collect_new_clients(worker %d): client fd %d classified dupefeed", self->id, c->fd);
class_next = self->clients_dupe;
class_prevp = &self->clients_dupe;

View File

@ -388,8 +388,9 @@ struct worker_t {
int shutting_down; /* should I shut down? */
struct client_t *clients; /* all clients handled by this thread */
/* c->class_next lists, classified clients */
/* c->class_next lists, classified clients for optimized outbound */
struct client_t *clients_dupe; /* dupeclient port clients */
struct client_t *clients_ro; /* read-only clients */
struct client_t *clients_other; /* other clients (unoptimized) */
pthread_mutex_t clients_mutex; /* mutex to protect access to the client list by the status dumps */