Add compatibility with stunnel v4 for Perforce.
Review Request #8011 — Created Feb. 27, 2016 and submitted
A few years back, we added support for stunnel for Perforce connections. This supported version 3, which used command line arguments to set up tunnels. Version 4, introduced in 2002, switched to a configuration file model, which was not compatible. Version 3 still seemed more common on some systems at the time, but that's no longer the case, and stunnel was therefore not an option on anything modern. This adds support for stunnel v4. We check the version (or rather, check an argument to determine if it's version 4 or higher), and then build up configuration files instead of argument lists. Along with this, I've fixed infinite loop issues that occur when trying to find a port on MacOS X, and added improved error logging and recovery.
Tested against stunnel v4. I was able to run the unit tests without any
problems.I don't have stunnel v3 to test with, but I left the arguments unchanged.