~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to src/bin/python-server

  • Committer: drtomc
  • Date: 2007-12-18 23:39:45 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:81
A few more refinements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
            i = buf.find('\r\n')
32
32
        s = sok.recv(4096)
33
33
 
 
34
shutup_shop_on_timeout = False
 
35
keep_going = True
 
36
 
34
37
def timeout(signum, frame):
35
 
    print 'signal: ', signum
 
38
    if shutup_shop_on_timeout:
 
39
        keep_going = False
 
40
        return
36
41
    raise Exception, 'Timeout!'
37
42
 
38
43
# signal.signal(signal.SIGALRM, timeout)
124
129
    global keep_going
125
130
    keep_going = True
126
131
    while keep_going:
 
132
        global shutup_shop_on_timeout
 
133
        shutup_shop_on_timeout = True
 
134
        signal.alarm(30 * 60) # timeout after 30 minutes
 
135
 
127
136
        (sok,addr) = main_sok.accept()
128
 
        # do checks on addr
 
137
 
 
138
        signal.alarm(0)
 
139
        shutup_shop_on_timeout = False
 
140
 
 
141
        # FIXME do checks on addr
129
142
 
130
143
        try:
131
144
            first = True