tcp: separate timeout marking loop to it's own function