from hippotat import *
-defcfg = '''
-[DEFAULT]
-max_requests_outstanding = 4
-
-[virtual]
-mtu = 1500
-# [server] # maybe computed from `network' (see server defaults)
-# [routes] # default is none
-
-[server]
-# url # maybe computed from `addrs' and `port' (see server defaults)
-
-# [<my ip address>]
-# password = <password>
-'''
-
client_cs = None
def set_client(ci,cs,pw):
process_cfg_clients(set_client)
- try:
- c.routes = cfg.get('virtual','routes')
- except NoOptionError:
- c.routes = ''
+ c.routes = cfg.get('virtual','routes')
+ c.max_queue_time = cfg.get(client_cs, 'max_queue_time')
process_cfg_ipif(client_cs,
(('local', 'client'),
('peer', 'server'),
('rnets', 'routes')))
+outstanding = 0
+
+def start_client():
+ global queue
+ queue = PacketQueue(c.max_queue_time)
+
def outbound(packet, saddr, daddr):
- print('OUT ', saddr, daddr, repr(packet))
- pass
+ #print('OUT ', saddr, daddr, repr(packet))
+ queue.append(packet)
+ check_outbound()
+
+def check_outbound():
+ while True:
+ if outstanding >= c.max_outstanding: break
+ elements = { }
+ if not queue.nonempty():
+ if outstanding >= c.target_
+
+ while (outstanding < and
+ (queue.notempty() or outstanding < c.
common_startup(defcfg)
process_cfg()