Esempio n. 1
0
 def attach_receiver(self, link, connection):
   key = (connection.container_id, link.name)
   if key in self.targets:
     target = self.targets[key]
     for tag, local in target.resuming():
       link.resume(tag, local)
     target.resume(link.remote_unsettled())
     link.source = link.remote_source
     # XXX: should actually set this to reflect the real target and
     # possibly update the real target
     link.target = link.remote_target
     return True
   else:
     n = self.resolve(link.remote_target)
     if n is None:
       return False
     else:
       target = n.target()
       local_target = target.configure(link.remote_target)
       self.targets[key] = target
       if target.capacity():
         link.flow(20)
       link.source = link.remote_source
       link.target = local_target
       return True
Esempio n. 2
0
  def process_receiver(self, link, connection):
    if link.target is None: return
    key = (connection.container_id, link.name)
    target = self.targets[key]

    for t, l, r in link.get_remote():
      if l.resumed:
        link.settle(t, None)
      elif r.settled and not isinstance(l.state, TransactionalState):
        state = target.settle(t, l.state)
        link.settle(t, state)

    if target.capacity() and link.credit() < 10: link.flow(10)