aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/network/sender.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/network/sender.c')
-rw-r--r--src/charon/network/sender.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/charon/network/sender.c b/src/charon/network/sender.c
index c1cd0a68c..90f03b7e8 100644
--- a/src/charon/network/sender.c
+++ b/src/charon/network/sender.c
@@ -84,10 +84,12 @@ static void send_(private_sender_t *this, packet_t *packet)
*/
static void send_packets(private_sender_t * this)
{
-
/* cancellation disabled by default */
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
DBG1(DBG_NET, "sender thread running, thread_ID: %06u", (int)pthread_self());
+
+ /* drop threads capabilities */
+ charon->drop_capabilities(charon, FALSE, FALSE);
while (TRUE)
{
@@ -119,9 +121,14 @@ static void send_packets(private_sender_t * this)
*/
static void destroy(private_sender_t *this)
{
+ /* send all packets in the queue */
+ while (this->list->get_count(this->list))
+ {
+ sched_yield();
+ }
pthread_cancel(this->assigned_thread);
pthread_join(this->assigned_thread, NULL);
- this->list->destroy_offset(this->list, offsetof(packet_t, destroy));
+ this->list->destroy(this->list);
free(this);
}