gypsum.pike: Refactor the autoconnection code to make it easier to interact with