make agent affinity a preference

Using the fact was cumbersome, especially as it had to be put in the agent's
home directory, and changed when the IP changed. Use the IP address generally
now, but old configuration can still override or be used for different
URLs/ports.