Advance ap if socket(2) fails

In the case where socket(2) fails in SocketConnect, ap will advance,
causing an infinite loop.

https://dev.cfengine.com/issues/6560

Found by one of our engineers.
Identical to last line of the else clause; so it would be better to do this *after* the branching, so both branches do it, without repeating the line of code.  Will fix.