Make reentrant, add connection function.

Signed-off-by: Mike Stitt <mikes@spindance.com>