fixed try/except/finally to be 2.4 compatible

This commit is contained in:
Brian Coca 2015-05-11 14:36:11 -04:00
parent 8ab439498c
commit d501f50c7b

View file

@ -234,6 +234,7 @@ class LocalSocketThread(Thread):
data = "" data = ""
while "\n" not in data: while "\n" not in data:
data += conn.recv(2048) data += conn.recv(2048)
try:
try: try:
new_key = AesKey.Read(data.strip()) new_key = AesKey.Read(data.strip())
found = False found = False
@ -587,6 +588,7 @@ def daemonize(module, password, port, timeout, minutes, use_ipv6, pid_file):
daemonize_self(module, password, port, minutes, pid_file) daemonize_self(module, password, port, minutes, pid_file)
def timer_handler(signum, _): def timer_handler(signum, _):
try:
try: try:
server.last_event_lock.acquire() server.last_event_lock.acquire()
td = datetime.now() - server.last_event td = datetime.now() - server.last_event
@ -703,6 +705,7 @@ def main():
if daemon_running and multi_key: if daemon_running and multi_key:
# try to connect to the file socket for the daemon if it exists # try to connect to the file socket for the daemon if it exists
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
try: try:
s.connect(SOCKET_FILE) s.connect(SOCKET_FILE)
s.sendall(password + '\n') s.sendall(password + '\n')