Browse Source

Avoid trying to parse messages or test the client's error if their fd has already been invalidated

master
Con Kolivas 10 years ago
parent
commit
2bde0bbe3d
  1. 5
      src/connector.c

5
src/connector.c

@ -506,10 +506,14 @@ void *receiver(void *arg)
LOGNOTICE("Failed to find client by id %"PRId64" in receiver!", event.data.u64); LOGNOTICE("Failed to find client by id %"PRId64" in receiver!", event.data.u64);
continue; continue;
} }
if (unlikely(client->fd == -1))
goto noparse;
/* We can have both messages and read hang ups so process the /* We can have both messages and read hang ups so process the
* message first. */ * message first. */
if (likely(event.events & EPOLLIN)) if (likely(event.events & EPOLLIN))
parse_client_msg(cdata, client); parse_client_msg(cdata, client);
if (unlikely(client->fd == -1))
goto noparse;
if (unlikely(event.events & EPOLLERR)) { if (unlikely(event.events & EPOLLERR)) {
socklen_t errlen = sizeof(int); socklen_t errlen = sizeof(int);
int error = 0; int error = 0;
@ -534,6 +538,7 @@ void *receiver(void *arg)
LOGINFO("Client id %"PRId64" fd %d RDHUP in epoll", client->id, client->fd); LOGINFO("Client id %"PRId64" fd %d RDHUP in epoll", client->id, client->fd);
invalidate_client(cdata->pi->ckp, cdata, client); invalidate_client(cdata->pi->ckp, cdata, client);
} }
noparse:
dec_instance_ref(cdata, client); dec_instance_ref(cdata, client);
} }
return NULL; return NULL;

Loading…
Cancel
Save