|
283 |
# Reconnect after closing current (defunc) connection |
283 |
# Reconnect after closing current (defunc) connection |
284 |
try: |
284 |
try: |
285 |
conn2 |
285 |
conn2 |
286 |
except: |
286 |
except NameError: |
287 |
conn2 = httplib.HTTPSConnection(options.sessionbrokerhost, options.port) |
287 |
conn2 = httplib.HTTPSConnection(options.sessionbrokerhost, options.port) |
288 |
conn2.auto_open = False |
288 |
conn2.auto_open = False |
289 |
conn2.connect() |
289 |
conn2.connect() |
|
295 |
log(2, 'alive event server response %d: %s\n' % (response.status, body)) |
295 |
log(2, 'alive event server response %d: %s\n' % (response.status, body)) |
296 |
if response.status == httplib.OK: # 200 |
296 |
if response.status == httplib.OK: # 200 |
297 |
continue |
297 |
continue |
|
|
298 |
elif response.status == httplib.REQUEST_TIMEOUT: # 408 |
299 |
log(0, 'timeout sending alive event, retrying') |
300 |
continue |
301 |
elif response.status == httplib.BAD_REQUEST: # 400 |
302 |
log(0, 'session invalidated by session broker, terminating') |
303 |
terminate() |
298 |
else: |
304 |
else: |
|
|
305 |
log(0, 'Unhandled error code %d, terminating' % response.status) |
299 |
terminate() |
306 |
terminate() |
300 |
except httplib.BadStatusLine: |
307 |
except httplib.BadStatusLine: |
301 |
log(0, 'connection closed while receiving alive event') |
308 |
log(0, 'connection closed while receiving alive event') |
|
318 |
body = response.read() |
325 |
body = response.read() |
319 |
except httplib.CannotSendRequest: |
326 |
except httplib.CannotSendRequest: |
320 |
pass |
327 |
pass |
|
|
328 |
except socket.error, (err, errstr): |
329 |
pass |
321 |
|
330 |
|
322 |
conn2.close() |
331 |
conn2.close() |
323 |
|
332 |
|