Ticket #876: mythtv_remoteblock2.patch
File mythtv_remoteblock2.patch, 4.4 KB (added by , 20 years ago) |
---|
-
libs/libmythtv/remoteutil.cpp
351 351 { 352 352 QStringList strlist = "QUERY_ISRECORDING"; 353 353 354 if (!gContext->SendReceiveStringList(strlist ))354 if (!gContext->SendReceiveStringList(strlist, false, false)) 355 355 return -1; 356 356 357 357 return strlist[0].toInt(); -
libs/libmyth/mythcontext.h
359 361 QPixmap *LoadScalePixmap(QString filename, bool fromcache = true); 360 362 QImage *LoadScaleImage(QString filename, bool fromcache = true); 361 363 362 bool SendReceiveStringList(QStringList &strlist, bool quickTimeout = false); 364 bool SendReceiveStringList(QStringList &strlist, bool quickTimeout = false, 365 bool block = true); 363 366 364 367 QImage *CacheRemotePixmap(const QString &url, bool reCache = false); 365 368 -
libs/libmyth/mythcontext.cpp
204 204 QString m_localhostname; 205 205 206 206 QMutex serverSockLock; 207 bool attemptingToConnect; 207 208 208 209 MDBManager m_dbmanager; 209 210 … … 263 264 m_baseWidth(800), m_baseHeight(600), 264 265 m_localhostname(QString::null), 265 266 serverSockLock(false), 267 attemptingToConnect(false), 266 268 language(""), 267 269 mainWindow(NULL), 268 270 m_wmult(1.0), m_hmult(1.0), … … 860 862 delete serverSock; 861 863 serverSock = NULL; 862 864 865 if (d->attemptingToConnect) 866 break; 867 d->attemptingToConnect = true; 868 863 869 // only inform the user of a failure if WOL is disabled 864 870 if (sleepTime <= 0) 865 871 { … … 870 876 "proper IP address."); 871 877 if (d->m_height && d->m_width) 872 878 { 879 bool manageLock = false; 880 if (!blockingClient && d->serverSockLock.locked()) 881 { 882 manageLock = true; 883 d->serverSockLock.unlock(); 884 } 873 885 MythPopupBox::showOkPopup(d->mainWindow, 874 886 "connection failure", 875 887 tr("Could not connect to the " … … 877 889 "it running? Is the IP " 878 890 "address set for it in the " 879 891 "setup program correct?")); 892 if (manageLock) 893 d->serverSockLock.lock(); 880 894 } 881 895 896 d->attemptingToConnect = false; 882 897 return false; 883 898 } 884 899 else … … 897 912 sleep(sleepTime); 898 913 ++cnt; 899 914 } 915 d->attemptingToConnect = false; 900 916 } 901 917 else 902 918 break; … … 2273 2289 ClearSettingsCache(key, newValue); 2274 2290 } 2275 2291 2276 bool MythContext::SendReceiveStringList(QStringList &strlist, bool quickTimeout )2292 bool MythContext::SendReceiveStringList(QStringList &strlist, bool quickTimeout, bool block) 2277 2293 { 2278 2294 d->serverSockLock.lock(); 2279 2295 2280 2296 if (!d->serverSock) 2297 { 2281 2298 ConnectToMasterServer(false); 2299 // should clear popup if it is currently active here. Not sure of the correct way. TBD 2300 } 2282 2301 2283 2302 bool ok = false; 2284 2303 … … 2312 2331 2313 2332 if (!ok) 2314 2333 { 2334 delete d->serverSock; 2335 d->serverSock = NULL; 2336 2315 2337 qApp->lock(); 2338 if (!block) 2339 d->serverSockLock.unlock(); 2316 2340 VERBOSE(VB_ALL, QString("Reconnection to backend server failed")); 2317 2341 if (d->m_height && d->m_width) 2318 2342 MythPopupBox::showOkPopup(d->mainWindow, "connection failure", … … 2320 2344 "server has gone away for some reason.. " 2321 2345 "Is it running?")); 2322 2346 2323 delete d->serverSock;2324 d->serverSock = NULL;2347 if (!block) 2348 d->serverSockLock.lock(); 2325 2349 qApp->unlock(); 2326 2350 } 2327 2351 }