Permalink
Browse files

implement wait command.

  • Loading branch information...
1 parent dc0f808 commit 17d3562d3be92e4e611406249b63407e9ef52047 @mwhooker mwhooker committed Dec 11, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 server.py
View
4 server.py
@@ -12,6 +12,7 @@ def mangodb(socket, address):
client = socket.makefile()
output = open(os.devnull, 'w')
lock = threading.Lock()
+ wait = threading.Condition(lock)
while 1:
line = client.readline()
if not line:
@@ -20,6 +21,9 @@ def mangodb(socket, address):
cmd = cmd_bits[0]
if cmd == 'BYE':
break
+ if cmd == 'WAIT':
+ wait.wait()
+ continue
if len(cmd_bits) > 1:
lock.acquire(True)
output.write(cmd_bits[1])

0 comments on commit 17d3562

Please sign in to comment.