Page MenuHomeFreeBSD

D14389.id39357.diff
No OneTemporary

D14389.id39357.diff

Index: stand/libsa/net.h
===================================================================
--- stand/libsa/net.h
+++ stand/libsa/net.h
@@ -61,6 +61,14 @@
#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.
+ */
+#define MAXWAIT 0 /* seconds */
+
#define FNAME_SIZE 128
#define IFNAME_SIZE 16
#define RECV_SIZE 1536 /* XXX delete this */
Index: stand/libsa/net.c
===================================================================
--- stand/libsa/net.c
+++ stand/libsa/net.c
@@ -76,7 +76,7 @@
void **pkt, void **payload, void *recv_extra)
{
ssize_t cc;
- time_t t, tmo, tlast;
+ time_t t, tmo, tlast, tref;
long tleft;
#ifdef NET_DEBUG
@@ -87,8 +87,13 @@
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;

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 27, 3:57 AM (12 m, 20 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16186500
Default Alt Text
D14389.id39357.diff (1 KB)

Event Timeline