Forgot to replace one ctx nb_sockets variable by nb_sockets

This commit is contained in:
Grégory Soutadé 2016-02-17 18:15:04 +01:00
parent 4b791be9f6
commit 978f9335f0

View File

@ -27,7 +27,7 @@
typedef struct {
int socket;
time_t timeout;
time_t timeout; // in µs
int nb_remaining_requests;
} socket_ctx_t;
@ -39,7 +39,7 @@ typedef struct thread_ctx_s{
int nb_cur_sockets;
int nb_available_sockets;
int max_timeout;
int max_sockets;
int max_sockets; // in ms
int stop;
int quiet;
pthread_mutex_t mutex;
@ -264,7 +264,7 @@ static void* thread_loop(void* param)
{
timersub(&time2, &time1, &time_res);
poll_idx = -1;
for(i=0; i<ctx->nb_cur_sockets; i++)
for(i=0; i<nb_cur_sockets; i++)
{
if (ctx->sockets[i].timeout < 0) continue;
poll_idx++;
@ -279,7 +279,7 @@ static void* thread_loop(void* param)
if (ctx->pollfds[poll_idx].revents & POLL_ERR_MASK)
{
if (ctx->quiet < 0)
syslog(LOG_ERR, "Error with socket %d", ctx->sockets[i].socket);
syslog(LOG_ERR, "Error (or closed) socket %d", ctx->sockets[i].socket);
close_socket(&ctx->sockets[i]);
}
// Someone is speaking