summaryrefslogtreecommitdiff
blob: 91d418e5f1ba28ff31b127f6fd2ad7606fa62b75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
diff -Naur beanstalkd-1.4.6.orig/prot.c beanstalkd-1.4.6/prot.c
--- beanstalkd-1.4.6.orig/prot.c	2010-05-23 03:37:28.000000000 -0400
+++ beanstalkd-1.4.6/prot.c	2011-01-10 19:44:05.000000000 -0500
@@ -305,7 +305,7 @@
     c->reply_len = len;
     c->reply_sent = 0;
     c->state = state;
-    dprintf("sending reply: %.*s", len, line);
+    dbgprintf("sending reply: %.*s", len, line);
 }
 
 #define reply_msg(c,m) reply((c),(m),CONSTSTRLEN(m),STATE_SENDWORD)
@@ -382,10 +382,10 @@
     size_t i;
     job j = NULL, candidate;
 
-    dprintf("tubes.used = %zu\n", tubes.used);
+    dbgprintf("tubes.used = %zu\n", tubes.used);
     for (i = 0; i < tubes.used; i++) {
         t = tubes.items[i];
-        dprintf("for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n",
+        dbgprintf("for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n",
                 t->name, t->waiting.used, t->ready.used, t->pause);
         if (t->pause) {
             if (t->deadline_at > now) continue;
@@ -395,7 +395,7 @@
             candidate = pq_peek(&t->ready);
             if (!j || job_pri_cmp(candidate, j) < 0) j = candidate;
         }
-        dprintf("i = %zu, tubes.used = %zu\n", i, tubes.used);
+        dbgprintf("i = %zu, tubes.used = %zu\n", i, tubes.used);
     }
 
     return j;
@@ -407,9 +407,9 @@
     job j;
     usec now = now_usec();
 
-    dprintf("processing queue\n");
+    dbgprintf("processing queue\n");
     while ((j = next_eligible_job(now))) {
-        dprintf("got eligible job %llu in %s\n", j->id, j->tube->name);
+        dbgprintf("got eligible job %llu in %s\n", j->id, j->tube->name);
         j = pq_take(&j->tube->ready);
         ready_ct--;
         if (j->pri < URGENT_THRESHOLD) {
@@ -462,7 +462,7 @@
 
     if (j && (!deadline_at || j->deadline_at < deadline_at)) deadline_at = j->deadline_at;
 
-    dprintf("deadline_at=%" PRIu64 "\n", deadline_at);
+    dbgprintf("deadline_at=%" PRIu64 "\n", deadline_at);
     set_main_timeout(deadline_at);
 }
 
@@ -1178,7 +1178,7 @@
     }
 
     type = which_cmd(c);
-    dprintf("got %s command: \"%s\"\n", op_names[(int) type], c->cmd);
+    dbgprintf("got %s command: \"%s\"\n", op_names[(int) type], c->cmd);
 
     switch (type) {
     case OP_PUT:
@@ -1578,10 +1578,10 @@
     }
 
     if (should_timeout) {
-        dprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
+        dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
         return reply_msg(remove_waiting_conn(c), MSG_DEADLINE_SOON);
     } else if (conn_waiting(c) && c->pending_timeout >= 0) {
-        dprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
+        dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c));
         c->pending_timeout = -1;
         return reply_msg(remove_waiting_conn(c), MSG_TIMED_OUT);
     }
@@ -1773,7 +1773,7 @@
     for (i = 0; i < tubes.used; i++) {
         t = tubes.items[i];
 
-        dprintf("h_delay for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n",
+        dbgprintf("h_delay for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n",
                 t->name, t->waiting.used, t->ready.used, t->pause);
         if (t->pause && t->deadline_at <= now) {
             t->pause = 0;
@@ -1811,7 +1811,7 @@
     c = make_conn(cfd, STATE_WANTCOMMAND, default_tube, default_tube);
     if (!c) return twarnx("make_conn() failed"), close(cfd), brake();
 
-    dprintf("accepted conn, fd=%d\n", cfd);
+    dbgprintf("accepted conn, fd=%d\n", cfd);
     r = conn_set_evq(c, EV_READ | EV_PERSIST, (evh) h_conn);
     if (r == -1) return twarnx("conn_set_evq() failed"), close(cfd), brake();
 }
diff -Naur beanstalkd-1.4.6.orig/util.h beanstalkd-1.4.6/util.h
--- beanstalkd-1.4.6.orig/util.h	2010-05-22 17:23:16.000000000 -0400
+++ beanstalkd-1.4.6/util.h	2011-01-10 19:43:44.000000000 -0500
@@ -43,9 +43,9 @@
                                    __FILE__, __LINE__, __func__, ##args)
 
 #ifdef DEBUG
-#define dprintf(fmt, args...) ((void) fprintf(stderr, fmt, ##args))
+#define dbgprintf(fmt, args...) ((void) fprintf(stderr, fmt, ##args))
 #else
-#define dprintf(fmt, ...) ((void) 0)
+#define dbgprintf(fmt, ...) ((void) 0)
 #endif
 
 typedef uint64_t usec;