Is 1.2.2 released as yet?
FWIW I have run into what appears to be this exact problem using 1.2.1 Firmware. And with can with just some print commands isolate it to
client.connect(server, 80)
If I remote disable the wifi radio at the right moment the code will stop right there and never return.
I attempted to do things like check WiFi.status() before executing client.connect but all indications are that status stays WL_Connected for a few seconds after the Wifi radio goes silent, thus allowing client.connect() to try and fail and not return either a true nor false.
So in the following code fragment example, I can see "Attempting to connect to server..." in the Serial Monitor but not "connecting..." which pretty clearly says client.connect() is going away and never coming back...
void makehttpRequest() {
// If Wifi died before this call bail out
if (WiFi.status() != WL_CONNECTED) {
return;
}
Serial.println("Attempting to connect to server...");
// if there's a successful connection:
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP PUT request:
client.println("GET /data/2.5/forecast?q=" + nameOfCity + "&APPID=" + apiKey + "&mode=json&units=imperial&cnt=5 HTTP/1.1");
client.println("Host: api.openweathermap.org");
client.println("User-Agent: ArduinoWiFi/1.1");
client.println("Connection: close");
client.println();
Serial.println("Request Sent...");
... etc etc