Browse Source

MT#18599 limit Homer send queue size

Change-Id: I490b7552fbfc57c839b80e2574cb69e68758d743
changes/48/5548/1
Richard Fuchs 10 years ago
parent
commit
d45f928c98
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      daemon/homer.c

+ 11
- 5
daemon/homer.c View File

@ -16,6 +16,11 @@
#define SEND_QUEUE_LIMIT 200
struct homer_sender {
mutex_t lock;
@ -208,17 +213,18 @@ int homer_send(struct homer_sender *hs, GString *s, const str *id, const endpoin
goto out;
mutex_lock(&hs->lock);
// XXX limit size of send queue
g_queue_push_tail(&hs->send_queue, s);
if (hs->send_queue.length < SEND_QUEUE_LIMIT) {
g_queue_push_tail(&hs->send_queue, s);
s = NULL;
}
else
ilog(LOG_ERR, "Send queue length limit (%i) reached, dropping Homer message", SEND_QUEUE_LIMIT);
hs->state(hs);
mutex_unlock(&hs->lock);
goto done;
out:
if (s)
g_string_free(s, TRUE);
done:
return 0;
}


Loading…
Cancel
Save