Exemple #1
0
def zope_started(event):
    """ Handling IProcessStarting Event """
    zlog = logging.getLogger("Zope")
    from asyncore import socket_map
    for server in socket_map.values():
        if server.addr:
            host, port = server.addr
            if host in ('127.0.0.1', '0.0.0.0'):
                host = 'localhost'
            zlog.info("Instance available on http://%s:%d", host, port)
            return
Exemple #2
0
def fork():
  pid = os.fork()
  if pid:
    # recreate the event pipe if it already exists
    for obj in socket_map.values():
      assert obj is ZEvent.the_trigger
      obj.close()
      ZEvent.the_trigger = ZEvent.simple_trigger()
    # make sure parent and child have 2 different RNG
    instance_random.seed(instance_random.random())
  return pid
Exemple #3
0
def fork():
  pid = os.fork()
  if pid:
    # recreate event pipes that already exist
    for obj in socket_map.values():
      obj.close()
      if obj is ZEvent.the_trigger:
        ZEvent.the_trigger = ZEvent.simple_trigger()
      else:
        assert obj is zrpc.ManagedServerConnection.trigger
        zrpc.ManagedServerConnection.trigger = zrpc.trigger()
        zrpc.ManagedClientConnection.trigger.close()
        zrpc.ManagedClientConnection.trigger = \
          zrpc.client_trigger = zrpc.trigger(zrpc.client_map)
    # make sure parent and child have 2 different RNG
    instance_random.seed(instance_random.random())
  return pid
Exemple #4
0
def fork():
  pid = os.fork()
  if pid:
    # recreate event pipes that already exist
    for obj in socket_map.values():
      obj.close()
      if obj is ZEvent.the_trigger:
        ZEvent.the_trigger = ZEvent.simple_trigger()
      else:
        assert obj is zrpc.ManagedServerConnection.trigger
        zrpc.ManagedServerConnection.trigger = zrpc.trigger()
        zrpc.ManagedClientConnection.trigger.close()
        zrpc.ManagedClientConnection.trigger = \
          zrpc.client_trigger = zrpc.trigger(zrpc.client_map)
    # make sure parent and child have 2 different RNG
    instance_random.seed(instance_random.random())
  return pid