BBlack has submitted this change and it was merged.
Change subject: A few minor fixups...
......................................................................
A few minor fixups...
1) A few fixups/improvements to cmdline usage output
2) increase default io timeout
3) remove pointless dequeue branches in idle state
Change-Id: Ic9bb89c671541c617bd855b5d76493e407d5c330
---
M src/main.c
M src/purger.c
2 files changed, 23 insertions(+), 19 deletions(-)
Approvals:
BBlack: Verified; Looks good to me, approved
diff --git a/src/main.c b/src/main.c
index 2bb4d0d..e3c7d45 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,13 +46,19 @@
#define DEF_Q_MB 256U
#define DEF_MCAST_PORT 4827U
#define DEF_STATS_FILE "/tmp/" PACKAGE_NAME ".stats"
-#define DEF_IO_TIMEOUT 7U
+#define DEF_IO_TIMEOUT 57U
#define DEF_IDLE_TIMEOUT 23U
static void usage(const char* argv0) {
- fprintf(stderr, "Usage:\n"
- "%s [-d] [-F] [-u %s] [-p %s] [-a %s] [-r host_regex] [-l %u] [-s %s]
[-t %u] [-T %u] -m mcast_addr -c cache_addr_port <action>\n"
- " -d -- Extra debug logging\n"
+ fprintf(stderr, PACKAGE_NAME " " PACKAGE_VERSION "\nUsage:\n"
+ "%s "
+#ifndef NDEBUG
+ "[-d] "
+#endif
+ "[-F] [-u %s] [-p %s] [-a %s] [-r host_regex] [-l %u] [-s %s] [-t %u]
[-T %u] -m mcast_addr -c cache_addr_port <action>\n"
+#ifndef NDEBUG
+ " -d -- Extra debug logging for developer build\n"
+#endif
" -F -- Use full absolute URL in PURGE request\n"
" -u -- Username for privilege drop\n"
" -p -- Pidfile pathname\n"
@@ -74,8 +80,8 @@
" condrestart - Does 'restart' action only if already running\n"
" try-restart - Aliases 'condrestart'\n"
" status - Checks the status of the running daemon\n\n",
- argv0, DEF_USERNAME, DEF_PIDFILE, def_ifaddr, DEF_Q_MB, DEF_STATS_FILE,
DEF_MCAST_PORT,
- DEF_IO_TIMEOUT, DEF_IDLE_TIMEOUT);
+ argv0, DEF_USERNAME, DEF_PIDFILE, def_ifaddr, DEF_Q_MB, DEF_STATS_FILE,
+ DEF_IO_TIMEOUT, DEF_IDLE_TIMEOUT, DEF_MCAST_PORT);
exit(99);
}
diff --git a/src/purger.c b/src/purger.c
index 9386bba..24f21dd 100644
--- a/src/purger.c
+++ b/src/purger.c
@@ -710,26 +710,24 @@
dmn_log_debug("purger: %s/%s -> hit purger_ping()",
dmn_logf_anysin(&s->daddr), state_strs[s->state]);
purger_assert_sanity(s);
- // ping is called immediately after an enqueue...
+ // ping is called immediately after an enqueue, thus dequeue
+ // always has an item to fetch
dmn_assert(!strq_is_empty(s->queue, s->vhead));
// enqueue can happen in any state, but actions differ:
switch(s->state) {
- // when in either idle state, the queue is empty and the outbuf
- // is empty, so encode directly to the outbuf and start up
- // I/O action...
+ // when in either idle state, dequeue and take action immediately
case PST_NOTCONN_IDLE:
- if(!dequeue_to_outbuf(s))
- purger_connect(s); // state transition is conditional within
+ dequeue_to_outbuf(s);
+ purger_connect(s); // state transition is conditional within
break;
case PST_CONN_IDLE:
- if(!dequeue_to_outbuf(s)) {
- ev_io_start(s->loop, s->write_watcher);
- ev_timer_stop(s->loop, s->timeout_watcher);
- ev_timer_set(s->timeout_watcher, s->io_timeout, 0.);
- ev_timer_start(s->loop, s->timeout_watcher);
- s->state = PST_SENDWAIT;
- }
+ dequeue_to_outbuf(s);
+ ev_io_start(s->loop, s->write_watcher);
+ ev_timer_stop(s->loop, s->timeout_watcher);
+ ev_timer_set(s->timeout_watcher, s->io_timeout, 0.);
+ ev_timer_start(s->loop, s->timeout_watcher);
+ s->state = PST_SENDWAIT;
break;
// When in non-idle states, there's nothing to do here.
--
To view, visit https://gerrit.wikimedia.org/r/65972
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9bb89c671541c617bd855b5d76493e407d5c330
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/varnish/vhtcpd
Gerrit-Branch: master
Gerrit-Owner: BBlack <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits