+
+ -- The feed is often unresponsive after we send out username. It
+ -- happens in a telnet session, too (albeit less frequently?),
+ -- so there might be a bug on their end.
+ --
+ -- If we dump the packets with tcpdump, it looks like their
+ -- software is getting confused: they send us some XML in
+ -- the middle of the log-in procedure. In any case, the easiest
+ -- fix is to disconnect and try again.
+ --
+ login_worked <- timeout five_seconds $ log_in cfg h
+ case login_worked of
+ Nothing -> putStrLn "Login timed out (5s)."
+ Just _ -> loop cfg h []