as it turned out , the enclosed walkway served as the connector between the doge 's palace and the doge 's prison , where the incarcerated languished and died , their groans of anguish echoing out of the grated windows along the narrow canal .