Added timer to detect connection failure