Changeset 219 for trunk/src/sh_forward.c
- Timestamp:
- Feb 24, 2009, 8:02:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_forward.c
r215 r219 842 842 SL_RETURN(i, _("sh_forward_req_file")); 843 843 } 844 845 static unsigned long sh_throttle_delay = 0; 846 847 int sh_forward_set_throttle_delay (const char * c) 848 { 849 long val; 850 851 SL_ENTER(_("sh_forward_set_throttle_delay")); 852 853 val = strtol (c, (char **)NULL, 10); 854 if (val < 0) 855 SL_RETURN( (-1), _("sh_forward_set_throttle_delay")); 856 857 val = (val > 1000) ? 1000 : val; 858 859 sh_throttle_delay = (unsigned long) val; 860 SL_RETURN( (0), _("sh_forward_set_throttle_delay")); 861 } 862 844 863 845 864 static long sh_forward_try_impl (char * errmsg, char what) … … 1682 1701 flag_err-KEY_LEN); 1683 1702 ++transfercount; 1703 /*** 1704 *** --- Delay for throughput throttling --- 1705 ***/ 1706 if (sh_throttle_delay > 0) 1707 retry_msleep(sh_throttle_delay/1000, sh_throttle_delay % 1000); 1708 /*** 1709 *** --- End delay --- 1710 ***/ 1684 1711 flag_err = 1685 1712 sh_forward_send_crypt (sockfd, (char) theProto, … … 4792 4819 } 4793 4820 4821 #define TIME_OUT_DEF 900 4822 static unsigned long time_out_val = TIME_OUT_DEF; 4823 4824 int sh_forward_set_timeout (const char * c) 4825 { 4826 long val; 4827 4828 SL_ENTER(_("sh_forward_set_time_out")); 4829 4830 val = strtol (c, (char **)NULL, 10); 4831 4832 if (val == 0) 4833 { 4834 val = TIME_OUT_DEF; 4835 } 4836 else if (val < 0) 4837 { 4838 time_out_val = TIME_OUT_DEF; 4839 SL_RETURN( (-1), _("sh_forward_set_time_out")); 4840 } 4841 4842 time_out_val = (unsigned long) val; 4843 SL_RETURN( (0), _("sh_forward_set_time_out")); 4844 } 4845 4846 4794 4847 static sh_conn_t * conns = NULL; 4795 #define TIME_OUT_DEF 9004796 4848 static int maxconn = 0; /* maximum number of simultaneous connections */ 4797 4849 … … 4906 4958 unsigned long time_now; 4907 4959 unsigned long time_last = 0; 4908 unsigned long time_out = TIME_OUT_DEF;4960 unsigned long time_out = time_out_val; 4909 4961 4910 4962 time_t told; … … 5198 5250 /* -- Exponentially reduce timeout limit if more than 1/2 full. -- 5199 5251 */ 5252 /* Eliminate this, will cause problems when too much clients are 5253 * starting up. */ 5254 #if 0 5200 5255 if (nowconn > (maxconn/2)) 5201 5256 time_out = ( (time_out/2) > 1) ? (time_out/2) : 1; 5202 5257 else 5203 time_out = TIME_OUT_DEF;5204 5258 time_out = time_out_val; 5259 #endif 5205 5260 5206 5261
Note:
See TracChangeset
for help on using the changeset viewer.