lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH to dev18] configurable connect timeout


From: Vlad Harchev
Subject: lynx-dev [PATCH to dev18] configurable connect timeout
Date: Mon, 31 Jan 2000 12:20:49 +0400 (SAMT)

* lynx.cfg option CONNECT_TIMEOUT and commandline option "timeout" were
  added (not available for DOS port) - VH

 Notes:
* Expect huge offsets and minor problems when applying.
* May be commandline option should be named "connect_timeout" too?
* Read comments added by that patch, and decide what to do about 
 "Connection failed for 180,000 tries." message (now number of tries depends
  on the user's setting).
* Tested under linux with address 213.12.12.12 - timeout tested was
  4 secs (seems it's possible to connect to it at all - nice address for
  testing!).

 Best regards,
  -Vlad

diff -ru old/WWW/Library/Implementation/HTTCP.c 
fixed/WWW/Library/Implementation/HTTCP.c
--- old/WWW/Library/Implementation/HTTCP.c      Thu Nov  4 00:31:08 1999
+++ fixed/WWW/Library/Implementation/HTTCP.c    Mon Jan 31 11:21:49 2000
@@ -1600,13 +1600,15 @@
            /*
            **  Protect against an infinite loop.
            */
-           if (tries++ >= 180000) {
+           if (tries++ >= (connect_timeout*10)) {
                HTAlert(gettext("Connection failed for 180,000 tries."));
+               /*this message could be wrong - ie different number of tries
+                 was performed, controlled by the user. -VH*/
                return HT_NO_DATA;
            }
 
 #ifdef _WINDOWS_NSL
-           timeout.tv_sec = 100;
+           timeout.tv_sec = connect_timeout;/*was 100 - VH*/
 #else
            timeout.tv_sec = 0;
 #endif /* _WINDOWS_NSL */
diff -ru old/lynx.cfg fixed/lynx.cfg
--- old/lynx.cfg        Mon Jan 31 11:46:42 2000
+++ fixed/lynx.cfg      Mon Jan 31 11:51:35 2000
@@ -2873,3 +2873,10 @@
 # If set to TRUE, the confirmation prompt is always issued.
 #
 #LEFTARROW_IN_TEXTFIELD_PROMPT:FALSE
+
+.h1 Internal Behavior
+
+.h2 CONNECT_TIMEOUT
+# Specifies (in seconds) connect timeout. Not available under DOS (use 
+# sockdelay parameter of wattcp). Default value is rather huge. 
+#CONNECT_TIMEOUT:18000
\ No newline at end of file
diff -ru old/lynx.hlp fixed/lynx.hlp
--- old/lynx.hlp        Thu Nov  4 00:31:16 1999
+++ fixed/lynx.hlp      Mon Jan 31 11:42:33 2000
@@ -541,9 +541,12 @@
               talking  to.   (This  may  be  useful  for   remote
               execution,  when,  for  example, Lynx connects to a
               remote TCP/IP port that starts a  script  that,  in
-
               turn, starts another Lynx process.)
-
+             
+       -timeout=N
+              Sets the N sec connect timeout. Not available under
+              DOS (use sockdelay parameter of wattcp under  DOS).
+                                  
        -tlog  toggles  between  using a Lynx Trace Log and stderr
               for trace output from the session.
 
diff -ru old/lynx.man fixed/lynx.man
--- old/lynx.man        Mon Jan 31 11:35:42 2000
+++ fixed/lynx.man      Mon Jan 31 11:36:43 2000
@@ -573,6 +573,10 @@
 Lynx connects to a remote TCP/IP port that starts a script that,
 in turn, starts another Lynx process.)
 .TP
+.B -timeout\fR=\fIN
+Sets the N sec connect timeout. Not available under DOS (use sockdelay 
+parameter of wattcp under DOS).
+.TP
 .B -tlog
 toggles between using a Lynx Trace Log and stderr for trace output
 from the session.
diff -ru old/src/LYGlobalDefs.h fixed/src/LYGlobalDefs.h
--- old/src/LYGlobalDefs.h      Wed Jan 26 23:23:58 2000
+++ fixed/src/LYGlobalDefs.h    Mon Jan 31 10:54:24 2000
@@ -409,6 +409,7 @@
 
 extern BOOL force_empty_hrefless_a;
 extern BOOL documents_do_not_expire;
+extern int connect_timeout;
 
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
 extern BOOL textfields_need_activation;
diff -ru old/src/LYMain.c fixed/src/LYMain.c
--- old/src/LYMain.c    Wed Jan 26 23:25:13 2000
+++ fixed/src/LYMain.c  Mon Jan 31 11:44:28 2000
@@ -438,6 +438,8 @@
 PUBLIC BOOLEAN dont_wrap_pre = FALSE;
 PUBLIC BOOLEAN documents_do_not_expire = FALSE;/*ignore cache control?*/
 
+PUBLIC int connect_timeout = 18000;/*=180000*0.1 - used in HTDoConnect.*/
+
 #ifdef EXP_JUSTIFY_ELTS
 PUBLIC BOOL ok_justify = TRUE;
 PUBLIC int justify_max_void_percent = 35;
@@ -3139,6 +3141,12 @@
       "force color mode on with standard bg colors"
    ),
 #endif
+#ifndef __DJGPP__
+   PARSE_SET(
+      "timeout",       NEED_INT_ARG,           &connect_timeout,
+      "=N\nset the N sec connect timeout"
+   ),
+#endif   
 #ifdef MISC_EXP
    PARSE_SET(
       "convert_to",    FUNCTION_ARG,           convert_to_fun,
diff -ru old/src/LYReadCFG.c fixed/src/LYReadCFG.c
--- old/src/LYReadCFG.c Wed Jan 26 23:27:36 2000
+++ fixed/src/LYReadCFG.c       Mon Jan 31 11:44:08 2000
@@ -1265,6 +1265,9 @@
 #ifdef USE_COLOR_TABLE
      PARSE_FUN("color", CONF_FUN, color_fun),
 #endif
+#ifndef __DJGPP__
+     PARSE_INT("connect_timeout",CONF_INT,&connect_timeout),
+#endif     
      PARSE_STR("cookie_accept_domains", CONF_STR, &LYCookieSAcceptDomains),
 #ifdef EXP_PERSISTENT_COOKIES
      PARSE_STR("cookie_file", CONF_STR, &LYCookieFile),


reply via email to

[Prev in Thread] Current Thread [Next in Thread]