Page MenuHomeFreeBSD

D14389.diff
No OneTemporary

D14389.diff

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

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)

Event Timeline