Remove unused vars and reset pollfd_index on disconnect.

pull/472/head
Roger A. Light 8 years ago
parent c07ba2a3da
commit 8f59d5ad28

@ -106,14 +106,12 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li
#endif #endif
int i; int i;
struct pollfd *pollfds = NULL; struct pollfd *pollfds = NULL;
int pollfd_count = 0;
int pollfd_index; int pollfd_index;
int pollfd_max; int pollfd_max;
#ifdef WITH_BRIDGE #ifdef WITH_BRIDGE
mosq_sock_t bridge_sock; mosq_sock_t bridge_sock;
int rc; int rc;
#endif #endif
int context_count;
time_t expiration_check_time = 0; time_t expiration_check_time = 0;
time_t last_timeout_check = 0; time_t last_timeout_check = 0;
char *id; char *id;
@ -147,12 +145,6 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li
} }
#endif #endif
context_count = HASH_CNT(hh_sock, db->contexts_by_sock);
#ifdef WITH_BRIDGE
context_count += db->bridge_count;
#endif
pollfd_count = listensock_count + context_count;
memset(pollfds, -1, sizeof(struct pollfd)*pollfd_max); memset(pollfds, -1, sizeof(struct pollfd)*pollfd_max);
pollfd_index = 0; pollfd_index = 0;
@ -445,6 +437,7 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context)
if(context->sock != INVALID_SOCKET){ if(context->sock != INVALID_SOCKET){
HASH_DELETE(hh_sock, db->contexts_by_sock, context); HASH_DELETE(hh_sock, db->contexts_by_sock, context);
context->sock = INVALID_SOCKET; context->sock = INVALID_SOCKET;
context->pollfd_index = -1;
} }
}else }else
#endif #endif

Loading…
Cancel
Save