The code inside the until is like the the one in the first request. Please, refactor it. 

```ruby
...
id, value = get_cookie()
host, port = cookie_decode(value)
...
```