} data;
struct sockent *next;
+ pthread_mutex_t lock;
} sockent_t;
/* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
sfree(se->node);
sfree(se->service);
+ pthread_mutex_destroy(&se->lock);
if (se->type == SOCKENT_TYPE_CLIENT)
free_sockent_client(&se->data.client);
se->service = NULL;
se->interface = 0;
se->next = NULL;
+ pthread_mutex_init(&se->lock, NULL);
if (type == SOCKENT_TYPE_SERVER) {
se->data.server.fd = NULL;
client->fd = -1;
}
+ DEBUG("network plugin: free (se = %p, addr = %p);", (void *)se,
+ (void *)client->addr);
sfree(client->addr);
client->addrlen = 0;
client->fd = -1;
continue;
}
+ DEBUG("network plugin: alloc (se = %p, addr = %p);", (void *)se,
+ (void *)client->addr);
assert(sizeof(*client->addr) >= ai_ptr->ai_addrlen);
memcpy(client->addr, ai_ptr->ai_addr, ai_ptr->ai_addrlen);
buffer_len);
for (sockent_t *se = sending_sockets; se != NULL; se = se->next) {
+ pthread_mutex_lock(&se->lock);
#if HAVE_GCRYPT_H
if (se->data.client.security_level == SECURITY_LEVEL_ENCRYPT)
network_send_buffer_encrypted(se, buffer, buffer_len);
else /* if (se->data.client.security_level == SECURITY_LEVEL_NONE) */
#endif /* HAVE_GCRYPT_H */
network_send_buffer_plain(se, buffer, buffer_len);
+ pthread_mutex_unlock(&se->lock);
} /* for (sending_sockets) */
} /* }}} void network_send_buffer */