#!/usr/bin/python3

import asyncio, signal, os
from  blink  import blink
import  ipc.coordinator

loop = asyncio.get_event_loop()

def my_interrupt_handler():
    print('Stopping')
    for task in asyncio.Task.all_tasks():
        task.cancel()
    loop.stop()

loop.add_signal_handler(signal.SIGINT, my_interrupt_handler)

blink.start()
ipc.coordinator.start(loop)

try:
    loop.run_forever()
except KeyboardInterrupt:
    pass
except asyncio.CancelledError:
    print('Tasks has been canceled')
finally:
    ipc.coordinator.stop()
    loop.close()

#!/usr/bin/python3

import asyncio, signal, os
from  blink  import blink
import  ipc.coordinator

loop = asyncio.get_event_loop()

def my_interrupt_handler():
    print('Stopping')
    for task in asyncio.Task.all_tasks():
        task.cancel()
    loop.stop()

loop.add_signal_handler(signal.SIGINT, my_interrupt_handler)

blink.start()
ipc.coordinator.start(loop)

try:
    loop.run_forever()
except KeyboardInterrupt:
    pass
except asyncio.CancelledError:
    print('Tasks has been canceled')
finally:
    ipc.coordinator.stop()
    os.remove('/tmp/coord.socket')
    loop.close()

Clean up socket file on exiting
Clean up socket file on exiting

Change-Id: I34391c64408b5a35386913bd7be01d81feed61b6
