https - SSLRead hangs then it returns with zero bytes read -


i'm using securetransport communicate google places api on https. however, when read response, somewhere in middle of it, sslread routine first hangs couple of minutes, returns 0 bytes read, leaving me incomplete response. be?

do {     if (httpresponsebodycontentlength > -1 && offset_recv >= httpresponsebodycontentlength) {         break;     }      size_t bytes_available;     (int try = 0; try < 30; try++) {         if ((ssl_status = sslgetbufferedreadsize(ssl_context, &bytes_available)) != 0) {             netdebuglog(@"%@", [nserror errorwithdomain:nsosstatuserrordomain code:ssl_status userinfo:nil]);             bytes_available = 0;             @try {                 usleep(30000);             }             @catch (nsexception *exception) {                 netdebuglog(@"%@", exception);             }         }         else if (bytes_available == 0) {             @try {                 usleep(30000);             }             @catch (nsexception *exception) {                 netdebuglog(@"%@", exception);             }         }         else {             break;         }     }     ssl_status = sslread(ssl_context, responsebodybuffer + offset_recv, min(responsebodybufferlength - offset_recv, bytes_available), &bytes_recv_size_t);     bytes_recv_int = bytes_recv_size_t;     netdebuglog(@"sslread() body: %zd bytes of %zd length (%ld offset)", bytes_recv_size_t, min(responsebodybufferlength - offset_recv, bytes_available), offset_recv);      if (ssl_status != 0) {         nserror *ssl_error = [nserror errorwithdomain:nsosstatuserrordomain code:ssl_status userinfo:nil];         netdebuglog(@"%@", ssl_error);     }      [responsebuffernsmutabledata appendbytes:responsebodybuffer + offset_recv length:bytes_recv_int];      responsebodytotallength += bytes_recv_int;     offset_recv += bytes_recv_int;      if (ssl_status == -36) {         @throw [nsexception exceptionwithname:@"naextensions"                                        reason:[[nsstring alloc]initwithformat:@"sslread() failed: %ld", bytes_recv_size_t]                                      userinfo:nil];     }     else if (offset_recv == responsebodybufferlength) {         offset_recv = 0;     } } while (bytes_recv_int > 0);