Fix two potential infinite loops in the connection logic:
- With -noconnect, the -connect code was trigger, but looped infinitely through the empty list of nodes
- Given restrictions on which networks to connect to, if no such nodes exist in addrman, the code would loop infinitely through the addresses being fetched. Break this loop after 100 iterations.
Closes #1664.