Eventloop must clear semaphore on restart
Call connection.close on connection lost
cosmetics