tcp: fix bug in listening_get_next()