Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107286983
D14389.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D14389.diff
View Options
Index: head/stand/libsa/net.h
===================================================================
--- head/stand/libsa/net.h
+++ head/stand/libsa/net.h
@@ -61,6 +61,20 @@
#define MAXTMO 120 /* seconds */
#define MINTMO 2 /* seconds */
+/*
+ * Maximum wait time for sending and receiving before we give up and timeout.
+ * If set to 0, operations will eventually timeout completely, but send/recv
+ * timeouts must progress exponentially from MINTMO to MAXTMO before final
+ * timeout is hit.
+ */
+#ifndef MAXWAIT
+#define MAXWAIT 0 /* seconds */
+#endif
+
+#if MAXWAIT < 0
+#error MAXWAIT must not be a negative number
+#endif
+
#define FNAME_SIZE 128
#define IFNAME_SIZE 16
#define RECV_SIZE 1536 /* XXX delete this */
Index: head/stand/libsa/net.c
===================================================================
--- head/stand/libsa/net.c
+++ head/stand/libsa/net.c
@@ -77,6 +77,7 @@
{
ssize_t cc;
time_t t, tmo, tlast;
+ time_t tref;
long tleft;
#ifdef NET_DEBUG
@@ -87,13 +88,14 @@
tmo = MINTMO;
tlast = 0;
tleft = 0;
+ tref = getsecs();
t = getsecs();
for (;;) {
+ if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) {
+ errno = ETIMEDOUT;
+ return -1;
+ }
if (tleft <= 0) {
- if (tmo >= MAXTMO) {
- errno = ETIMEDOUT;
- return -1;
- }
cc = (*sproc)(d, sbuf, ssize);
if (cc != -1 && cc < ssize)
panic("sendrecv: short write! (%zd < %zd)",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 12:33 AM (20 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15774245
Default Alt Text
D14389.diff (1 KB)
Attached To
Mode
D14389: libsa: Add MAXWAIT to net for establishing max total timeout
Attached
Detach File
Event Timeline
Log In to Comment