... | ... |
@@ -61,7 +61,7 @@ MAIN_NAME=ser |
61 | 61 |
VERSION = 0 |
62 | 62 |
PATCHLEVEL = 10 |
63 | 63 |
SUBLEVEL = 99 |
64 |
-EXTRAVERSION = -dev26-tm-timers |
|
64 |
+EXTRAVERSION = -dev27-tm-timers |
|
65 | 65 |
|
66 | 66 |
RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
67 | 67 |
OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]") |
... | ... |
@@ -27,6 +27,8 @@ modules: |
27 | 27 |
delete_timer, retr_timer1, retr_timer2 |
28 | 28 |
- retr_timer1 (first retransmission) changed to 500 ms |
29 | 29 |
- delete_timer changed to 200 ms |
30 |
+ - unix_tx_timeout expressed now in milliseconds; default |
|
31 |
+ value changed to 500 ms |
|
30 | 32 |
- functions: |
31 | 33 |
- new t_set_fr(timeout_fr_inv, timeout_fr) -- allows |
32 | 34 |
changing the transaction timer from script, even if |
... | ... |
@@ -155,4 +155,26 @@ modparam("tm", "noisy_ctimer", 1) |
155 | 155 |
</example> |
156 | 156 |
</section> |
157 | 157 |
|
158 |
+ <section id="unix_tx_timeout"> |
|
159 |
+ <title><varname>unix_tx_timeout</varname> (integer)</title> |
|
160 |
+ <para> |
|
161 |
+ Unix socket transmission timeout, in milliseconds. |
|
162 |
+ </para> |
|
163 |
+ <para> |
|
164 |
+ If unix sockets are used (e.g.: to communicate with sems) and sending |
|
165 |
+ a message on a unix socket takes longer then |
|
166 |
+ <varname>unix_tx_timeout</varname>, the send will fail. |
|
167 |
+ </para> |
|
168 |
+ <para> |
|
169 |
+ The default value is 500 milliseconds. |
|
170 |
+ </para> |
|
171 |
+ <example> |
|
172 |
+ <title>Set <varname>unix_tx_timeout</varname> parameter</title> |
|
173 |
+ <programlisting> |
|
174 |
+... |
|
175 |
+modparam("tm", "unix_tx_timeout", 250) |
|
176 |
+... |
|
177 |
+ </programlisting> |
|
178 |
+ </example> |
|
179 |
+ </section> |
|
158 | 180 |
</section> |
... | ... |
@@ -82,7 +82,7 @@ |
82 | 82 |
|
83 | 83 |
|
84 | 84 |
|
85 |
-int tm_unix_tx_timeout = 2; /* Default is 2 seconds */ |
|
85 |
+int tm_unix_tx_timeout = 500; /* Default is 500 ms */ |
|
86 | 86 |
|
87 | 87 |
#define TWRITE_PARAMS 20 |
88 | 88 |
#define TWRITE_VERSION_S "0.3" |
... | ... |
@@ -952,7 +952,7 @@ static int write_to_unixsock(char* sockname, int cnt) |
952 | 952 |
return -1; |
953 | 953 |
} |
954 | 954 |
|
955 |
- if (tsend_dgram_ev(sock, iov_lines_eol, 2 * cnt, tm_unix_tx_timeout * 1000) < 0) { |
|
955 |
+ if (tsend_dgram_ev(sock, iov_lines_eol, 2 * cnt, tm_unix_tx_timeout) < 0) { |
|
956 | 956 |
LOG(L_ERR, "write_to_unixsock: writev failed: %s\n", strerror(errno)); |
957 | 957 |
return -1; |
958 | 958 |
} |
... | ... |
@@ -42,18 +42,28 @@ |
42 | 42 |
#include <sys/uio.h> |
43 | 43 |
|
44 | 44 |
#include "dprint.h" |
45 |
+#include "timer.h" |
|
46 |
+#include "timer_ticks.h" |
|
45 | 47 |
|
46 | 48 |
/* the functions below are very similar => some generic macros */ |
47 | 49 |
#define TSEND_INIT \ |
48 | 50 |
int n; \ |
49 | 51 |
struct pollfd pf; \ |
52 |
+ ticks_t expire; \ |
|
53 |
+ s_ticks_t diff; \ |
|
54 |
+ expire=get_ticks_raw()+MS_TO_TICKS((ticks_t)timeout); \ |
|
50 | 55 |
pf.fd=fd; \ |
51 | 56 |
pf.events=POLLOUT |
52 | 57 |
|
53 | 58 |
#define TSEND_POLL(f_name) \ |
54 | 59 |
poll_loop: \ |
55 | 60 |
while(1){ \ |
56 |
- n=poll(&pf, 1, timeout); \ |
|
61 |
+ diff=expire-get_ticks_raw(); \ |
|
62 |
+ if (diff<=0){ \ |
|
63 |
+ LOG(L_ERR, "ERROR: " f_name ": send timeout (%d)\n", timeout); \ |
|
64 |
+ goto error; \ |
|
65 |
+ } \ |
|
66 |
+ n=poll(&pf, 1, TICKS_TO_MS((ticks_t)diff)); \ |
|
57 | 67 |
if (n<0){ \ |
58 | 68 |
if (errno==EINTR) continue; /* signal, ignore */ \ |
59 | 69 |
LOG(L_ERR, "ERROR: " f_name ": poll failed: %s [%d]\n", \ |
... | ... |
@@ -61,7 +71,7 @@ poll_loop: \ |
61 | 71 |
goto error; \ |
62 | 72 |
}else if (n==0){ \ |
63 | 73 |
/* timeout */ \ |
64 |
- LOG(L_ERR, "ERROR: " f_name ": send timeout (%d)\n", timeout); \ |
|
74 |
+ LOG(L_ERR, "ERROR: " f_name ": send timeout (p %d)\n", timeout); \ |
|
65 | 75 |
goto error; \ |
66 | 76 |
} \ |
67 | 77 |
if (pf.revents&POLLOUT){ \ |