c.routes = cfg.get('virtual','routes')
c.max_queue_time = cfg.getint(client_cs, 'max_queue_time')
c.max_batch_up = cfg.getint(client_cs, 'max_batch_up')
- c.http_timeout = cfg.getint(client_cs, 'http_timeout')
c.http_retry = cfg.getint(client_cs, 'http_retry')
+ c.http_timeout = (cfg.getint(client_cs, 'http_timeout') +
+ cfg.getint(client_cs, 'http_timeout_grace'))
process_cfg_ipif(client_cs,
(('local', 'client'),
str(c.client) .encode('ascii') + crlf +
password + crlf +
str(c.target_outstanding) .encode('ascii') + crlf +
+ str(c.http_timeout) .encode('ascii') + crlf +
((
b'--b' + crlf +
b'Content-Type: application/octet-stream' + crlf +
if idof is not None:
msg = '[%#x] %s' % (id(idof), msg)
if d is not None:
- d = d[0:64]
+ #d = d[0:64]
d = _hex_codec(d)[0].decode('ascii')
msg += ' ' + d
log.info('{dflag} {msgcore}', dflag=dflag, msgcore=msg)
#[<client>] overrides
max_batch_down = 65536 # used by server, subject to [limits]
max_queue_time = 10 # used by server, subject to [limits]
-max_request_time = 54 # used by server, subject to [limits]
target_requests_outstanding = 3 # must match; subject to [limits] on server
+http_timeout = 30 # used by both } must be
+http_timeout_grace = 5 # used by both } compatible
max_requests_outstanding = 4 # used by client
max_batch_up = 4000 # used by client
-http_timeout = 30 # used by client
http_retry = 5 # used by client
#[server] or [<client>] overrides
[limits]
max_batch_down = 262144 # used by server
max_queue_time = 121 # used by server
-max_request_time = 121 # used by server
+http_timeout = 121 # used by server
target_requests_outstanding = 10 # used by server
'''
def inputdata(self, data):
self._log('inputdata', d=data)
- data = self._buffer + data
- self._buffer = b''
packets = slip.decode(data)
+ packets[0] = self._buffer + packets[0]
self._buffer = packets.pop()
for packet in packets:
self._maybe_packet(packet)
# plus from config:
# .max_batch_down
# .max_queue_time
- # .max_request_time
# .target_requests_outstanding
if ip not in c.network:
raise ValueError('client %s not in network' % ip)
- for k in ('max_batch_down','max_queue_time','max_request_time',
+ for k in ('max_batch_down','max_queue_time','http_timeout',
'target_requests_outstanding'):
req = cfg.getint(cs, k)
limit = cfg.getint('limits',k)
def new_request(self, request):
request.setHeader('Content-Type','application/octet-stream')
- reactor.callLater(self.max_request_time, self._req_cancel, request)
+ reactor.callLater(self.http_timeout, self._req_cancel, request)
request.notifyFinish().addErrback(self._req_error, request)
self._rq.append(request)
self._check_outbound()
# find client, update config, etc.
metadata = request.args[b'm'][0]
metadata = metadata.split(b'\r\n')
- (ci_s, pw, tro) = metadata[0:3]
- desca['m[0,2]'] = [ci_s, tro]
+ (ci_s, pw, tro, cto) = metadata[0:4]
+ desca['m[0,2:3]'] = [ci_s, tro, cto]
ci_s = ci_s.decode('utf-8')
- tro = int(tro)
- desca['tro']= tro
+ tro = int(tro); desca['tro']= tro
+ cto = int(cto); desca['cto']= cto
ci = ipaddr(ci_s)
desca['ci'] = ci
cl = clients[ci]
if tro != cl.target_requests_outstanding:
raise ValueError('tro must be %d' % cl.target_requests_outstanding)
+ if cto < cl.http_timeout:
+ raise ValueError('cto must be >= %d' % cl.http_timeout)
+
try:
d = request.args[b'd'][0]
desca['d'] = d