
from common import *
import sys, signal

# Be naughty and ignore SIGTERM to simulate hanging child
signal.signal(signal.SIGTERM, signal.SIG_IGN)

# Start a server that listens for incoming connections
try:
    print_ok("child starting up on port %s" % sys.argv[1])
    s = TcpServer(int(sys.argv[1]))
    s.listen()
    while True:
        try:
            s.socket, _ = s.listener.accept()
            s.socket.settimeout(TIMEOUT)
        except:
            pass
finally:
    s.cleanup()

print_ok("child exiting")


from common import *
import sys, signal

# Be naughty and ignore SIGTERM to simulate hanging child
signal.signal(signal.SIGTERM, signal.SIG_IGN)

# Start a server that listens for incoming connections
try:
  print_ok("child starting up on port %s" % sys.argv[1])
  s = TcpServer(int(sys.argv[1]))
  s.listen()
  while True:
    try:
      s.socket, _ = s.listener.accept()
      s.socket.settimeout(TIMEOUT)
    except:
      pass
finally:
  s.cleanup()

print_ok("child exiting")

Fix formatting in child sample to match other files
Fix formatting in child sample to match other files

  
  from common import *
  import sys, signal
  
  # Be naughty and ignore SIGTERM to simulate hanging child
  signal.signal(signal.SIGTERM, signal.SIG_IGN)
  
  # Start a server that listens for incoming connections
  try:
-     print_ok("child starting up on port %s" % sys.argv[1])
+   print_ok("child starting up on port %s" % sys.argv[1])
-     s = TcpServer(int(sys.argv[1]))
+   s = TcpServer(int(sys.argv[1]))
-     s.listen()
+   s.listen()
-     while True:
+   while True:
-         try:
+     try:
-             s.socket, _ = s.listener.accept()
+       s.socket, _ = s.listener.accept()
-             s.socket.settimeout(TIMEOUT)
+       s.socket.settimeout(TIMEOUT)
-         except:
+     except:
-             pass
+       pass
  finally:
-     s.cleanup()
+   s.cleanup()
  
  print_ok("child exiting")
  
Fix formatting in child sample to match other files
## Code Before:

from common import *
import sys, signal

# Be naughty and ignore SIGTERM to simulate hanging child
signal.signal(signal.SIGTERM, signal.SIG_IGN)

# Start a server that listens for incoming connections
try:
    print_ok("child starting up on port %s" % sys.argv[1])
    s = TcpServer(int(sys.argv[1]))
    s.listen()
    while True:
        try:
            s.socket, _ = s.listener.accept()
            s.socket.settimeout(TIMEOUT)
        except:
            pass
finally:
    s.cleanup()

print_ok("child exiting")

## Instruction:
Fix formatting in child sample to match other files
## Code After:

from common import *
import sys, signal

# Be naughty and ignore SIGTERM to simulate hanging child
signal.signal(signal.SIGTERM, signal.SIG_IGN)

# Start a server that listens for incoming connections
try:
  print_ok("child starting up on port %s" % sys.argv[1])
  s = TcpServer(int(sys.argv[1]))
  s.listen()
  while True:
    try:
      s.socket, _ = s.listener.accept()
      s.socket.settimeout(TIMEOUT)
    except:
      pass
finally:
  s.cleanup()

print_ok("child exiting")
