diff --git a/mythtv/programs/mythbackend/encoderlink.cpp b/mythtv/programs/mythbackend/encoderlink.cpp
index 2c7bc76..95cf662 100644
--- a/mythtv/programs/mythbackend/encoderlink.cpp
+++ b/mythtv/programs/mythbackend/encoderlink.cpp
@@ -41,6 +41,7 @@ EncoderLink::EncoderLink(int capturecardnum, PlaybackSock *lsock,
                          QString lhostname)
     : m_capturecardnum(capturecardnum), sock(lsock), hostname(lhostname),
       freeDiskSpaceKB(-1), tv(NULL), local(false), locked(false),
+      disconnected(false),
       sleepStatus(sStatus_Undefined), chanid(0)
 {
     endRecordingTime = MythDate::current().addDays(-2);
@@ -50,6 +51,7 @@ EncoderLink::EncoderLink(int capturecardnum, PlaybackSock *lsock,
     lastSleepTime   = MythDate::current();
     lastWakeTime    = MythDate::current();
 
+    QMutexLocker locker(&sockLock);
     if (sock)
         sock->IncrRef();
 }
@@ -60,6 +62,7 @@ EncoderLink::EncoderLink(int capturecardnum, PlaybackSock *lsock,
 EncoderLink::EncoderLink(int capturecardnum, TVRec *ltv)
     : m_capturecardnum(capturecardnum), sock(NULL),
       freeDiskSpaceKB(-1), tv(ltv), local(true), locked(false),
+      disconnected(false),
       sleepStatus(sStatus_Undefined), chanid(0)
 {
     endRecordingTime = MythDate::current().addDays(-2);
@@ -81,6 +84,7 @@ EncoderLink::~EncoderLink(void)
         delete tv;
         tv = NULL;
     }
+    disconnected = true;
 }
 
 /** \fn EncoderLink::SetSocket(PlaybackSock *lsock)
@@ -90,6 +94,7 @@ EncoderLink::~EncoderLink(void)
  */
 void EncoderLink::SetSocket(PlaybackSock *lsock)
 {
+    QMutexLocker locker(&sockLock);
     if (lsock)
     {
         lsock->IncrRef();
@@ -99,19 +104,21 @@ void EncoderLink::SetSocket(PlaybackSock *lsock)
         else
             SetSleepStatus(sStatus_Awake);
     }
-    else
-    {
-        if (IsFallingAsleep())
-            SetSleepStatus(sStatus_Asleep);
-        else
-            SetSleepStatus(sStatus_Undefined);
-    }
-
-    if (sock)
-        sock->DecrRef();
     sock = lsock;
 }
 
+void EncoderLink::Disconnect()
+{
+  disconnected = true;
+  if (IsFallingAsleep())
+      SetSleepStatus(sStatus_Asleep);
+  else
+      SetSleepStatus(sStatus_Undefined);
+
+  if (sock)
+      sock->DecrRef();
+}
+
 /** \fn EncoderLink::SetSleepStatus(SleepStatus)
  *  \brief Sets the sleep status of a recorder
  */
@@ -128,9 +135,13 @@ void EncoderLink::SetSleepStatus(SleepStatus newStatus)
  */
 bool EncoderLink::IsBusy(TunedInputInfo *busy_input, int time_buffer)
 {
+    if (disconnected)
+        return false;
+
     if (local)
         return tv->IsBusy(busy_input, time_buffer);
 
+    QMutexLocker locker(&sockLock);
     if (sock)
         return sock->IsBusy(m_capturecardnum, busy_input, time_buffer);
 
@@ -149,6 +160,9 @@ bool EncoderLink::IsBusyRecording(void)
 {
     bool retval = false;
 
+    if (disconnected)
+        return false;
+
     TVState state = GetState();
 
     if (state == kState_RecordingOnly || state == kState_WatchingRecording ||
@@ -174,7 +188,11 @@ TVState EncoderLink::GetState(void)
     if (local)
         retval = tv->GetState();
     else if (sock)
-        retval = (TVState)sock->GetEncoderState(m_capturecardnum);
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            retval = (TVState)sock->GetEncoderState(m_capturecardnum);
+    }
     else
         LOG(VB_GENERAL, LOG_ERR, QString("Broken for card: %1")
             .arg(m_capturecardnum));
@@ -186,17 +204,21 @@ TVState EncoderLink::GetState(void)
  *  \brief Returns the flag state of the recorder.
  *  \sa TVRec::GetFlags(void) const, \ref recorder_subsystem
  */
-uint EncoderLink::GetFlags(void) const
+uint EncoderLink::GetFlags(void)
 {
     uint retval = 0;
 
-    if (!IsConnected())
+    if (disconnected)
         return retval;
 
     if (local)
         retval = tv->GetFlags();
     else if (sock)
-        retval = sock->GetEncoderState(m_capturecardnum);
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            retval = sock->GetEncoderState(m_capturecardnum);
+    }
     else
         LOG(VB_GENERAL, LOG_ERR, LOC + "GetFlags failed");
 
@@ -210,6 +232,8 @@ uint EncoderLink::GetFlags(void) const
  */
 bool EncoderLink::IsRecording(const ProgramInfo *rec)
 {
+    if (disconnected)
+        return false;
     return (rec->GetChanID() == chanid &&
             rec->GetRecordingStartTime() == startRecordingTime);
 }
@@ -227,6 +251,9 @@ bool EncoderLink::MatchesRecording(const ProgramInfo *rec)
     bool retval = false;
     ProgramInfo *tvrec = NULL;
 
+    if (disconnected)
+        return false;
+
     if (local)
     {
         while (kState_ChangingState == GetState())
@@ -243,6 +270,7 @@ bool EncoderLink::MatchesRecording(const ProgramInfo *rec)
     }
     else
     {
+        QMutexLocker locker(&sockLock);
         if (sock)
             retval = sock->EncoderIsRecording(m_capturecardnum, rec);
     }
@@ -261,10 +289,17 @@ bool EncoderLink::MatchesRecording(const ProgramInfo *rec)
 void EncoderLink::RecordPending(const ProgramInfo *rec, int secsleft,
                                 bool hasLater)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->RecordPending(rec, secsleft, hasLater);
-    else if (sock)
-        sock->RecordPending(m_capturecardnum, rec, secsleft, hasLater);
+    else
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            sock->RecordPending(m_capturecardnum, rec, secsleft, hasLater);
+   }
 }
 
 /** \fn EncoderLink::WouldConflict(const ProgramInfo*)
@@ -286,6 +321,10 @@ bool EncoderLink::WouldConflict(const ProgramInfo *rec)
 /// Checks if program is stored locally
 bool EncoderLink::CheckFile(ProgramInfo *pginfo)
 {
+    if (disconnected)
+        return false;
+
+    QMutexLocker locker(&sockLock);
     if (sock)
         return sock->CheckFile(pginfo);
 
@@ -300,6 +339,10 @@ bool EncoderLink::CheckFile(ProgramInfo *pginfo)
  */
 void EncoderLink::GetDiskSpace(QStringList &o_strlist)
 {
+    if (disconnected)
+        return;
+
+    QMutexLocker locker(&sockLock);
     if (sock)
         sock->GetDiskSpace(o_strlist);
 }
@@ -312,11 +355,17 @@ void EncoderLink::GetDiskSpace(QStringList &o_strlist)
  */
 long long EncoderLink::GetMaxBitrate()
 {
+    if (disconnected)
+        return -1;
+
     if (local)
         return tv->GetMaxBitrate();
-    else if (sock)
-        return sock->GetMaxBitrate(m_capturecardnum);
-
+    else
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            return sock->GetMaxBitrate(m_capturecardnum);
+    }
     return -1;
 }
 
@@ -338,9 +387,13 @@ int EncoderLink::SetSignalMonitoringRate(int rate, int notifyFrontend)
 {
     if (local)
         return tv->SetSignalMonitoringRate(rate, notifyFrontend);
-    else if (sock)
-        return sock->SetSignalMonitoringRate(m_capturecardnum, rate,
-                                             notifyFrontend);
+    else
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            return sock->SetSignalMonitoringRate(m_capturecardnum, rate,
+                                                 notifyFrontend);
+    }
     return -1;
 }
 
@@ -348,9 +401,23 @@ int EncoderLink::SetSignalMonitoringRate(int rate, int notifyFrontend)
  */
 bool EncoderLink::GoToSleep(void)
 {
-    if (IsLocal() || !sock)
+    if (disconnected)
         return false;
 
+    if (IsLocal())
+        return false;
+
+    QMutexLocker locker(&sockLock);
+    if (!sock)
+        return false;
+
+    if (sock->getBlockShutdown())
+    {
+        LOG(VB_GENERAL, LOG_NOTICE,
+            QString("EncoderLink::GoToSleep() Socket shutdown is currently blocked!"));
+        return false;
+    }
+
     lastSleepTime = MythDate::current();
 
     return sock->GoToSleep();
@@ -362,6 +429,9 @@ bool EncoderLink::GoToSleep(void)
  */
 int EncoderLink::LockTuner()
 {
+    if (disconnected)
+        return -2;
+
     if (locked)
         return -2;
 
@@ -380,19 +450,26 @@ RecStatusType EncoderLink::StartRecording(const ProgramInfo *rec)
 {
     RecStatusType retval = rsAborted;
 
+    if (disconnected)
+        return retval;
+
     endRecordingTime = rec->GetRecordingEndTime();
     startRecordingTime = rec->GetRecordingStartTime();
     chanid = rec->GetChanID();
 
     if (local)
         retval = tv->StartRecording(rec);
-    else if (sock)
-        retval = sock->StartRecording(m_capturecardnum, rec);
     else
-        LOG(VB_GENERAL, LOG_ERR,
-            QString("Wanted to start recording on recorder %1,\n\t\t\t"
-                    "but the backend is not there anymore\n")
-                .arg(m_capturecardnum));
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            retval = sock->StartRecording(m_capturecardnum, rec);
+        else
+            LOG(VB_GENERAL, LOG_ERR,
+                QString("Wanted to start recording on recorder %1,\n\t\t\t"
+                        "but the backend is not there anymore\n")
+                    .arg(m_capturecardnum));
+    }
 
     if (retval != rsRecording && retval != rsTuning)
     {
@@ -408,15 +485,22 @@ RecStatusType EncoderLink::GetRecordingStatus(void)
 {
     RecStatusType retval = rsAborted;
 
+    if (disconnected)
+        return retval;
+
     if (local)
         retval = tv->GetRecordingStatus();
-    else if (sock)
-        retval = sock->GetRecordingStatus(m_capturecardnum);
     else
-        LOG(VB_GENERAL, LOG_ERR,
-            QString("Wanted to get status on recorder %1,\n\t\t\t"
-                    "but the backend is not there anymore\n")
-                .arg(m_capturecardnum));
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            retval = sock->GetRecordingStatus(m_capturecardnum);
+        else
+            LOG(VB_GENERAL, LOG_ERR,
+                QString("Wanted to get status on recorder %1,\n\t\t\t"
+                        "but the backend is not there anymore\n")
+                    .arg(m_capturecardnum));
+    }
 
     if (retval != rsRecording && retval != rsTuning)
     {
@@ -438,10 +522,17 @@ ProgramInfo *EncoderLink::GetRecording(void)
 {
     ProgramInfo *info = NULL;
 
+    if (disconnected)
+        return info;
+
     if (local)
         info = tv->GetRecording();
-    else if (sock)
-        info = sock->GetRecording(m_capturecardnum);
+    else
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            info = sock->GetRecording(m_capturecardnum);
+    }
 
     return info;
 }
@@ -453,6 +544,9 @@ ProgramInfo *EncoderLink::GetRecording(void)
  */
 void EncoderLink::StopRecording(bool killFile)
 {
+    if (disconnected)
+        return;
+
     endRecordingTime = MythDate::current().addDays(-2);
     startRecordingTime = endRecordingTime;
     chanid = 0;
@@ -471,6 +565,9 @@ void EncoderLink::StopRecording(bool killFile)
  */
 void EncoderLink::FinishRecording(void)
 {
+    if (disconnected)
+        return;
+
     if (local)
     {
         tv->FinishRecording();
@@ -505,6 +602,9 @@ bool EncoderLink::IsReallyRecording(void)
  */
 float EncoderLink::GetFramerate(void)
 {
+    if (disconnected)
+        return -1;
+
     if (local)
         return tv->GetFramerate();
 
@@ -521,6 +621,9 @@ float EncoderLink::GetFramerate(void)
  */
 long long EncoderLink::GetFramesWritten(void)
 {
+    if (disconnected)
+        return -1;
+
     if (local)
         return tv->GetFramesWritten();
 
@@ -536,6 +639,9 @@ long long EncoderLink::GetFramesWritten(void)
  */
 long long EncoderLink::GetFilePosition(void)
 {
+    if (disconnected)
+        return -1;
+
     if (local)
         return tv->GetFilePosition();
 
@@ -551,6 +657,9 @@ long long EncoderLink::GetFilePosition(void)
  */
 int64_t EncoderLink::GetKeyframePosition(uint64_t desired)
 {
+    if (disconnected)
+        return -1;
+
     if (local)
         return tv->GetKeyframePosition(desired);
 
@@ -561,6 +670,9 @@ int64_t EncoderLink::GetKeyframePosition(uint64_t desired)
 bool EncoderLink::GetKeyframePositions(
     int64_t start, int64_t end, frm_pos_map_t &map)
 {
+    if (disconnected)
+        return false;
+
     if (!local)
     {
         LOG(VB_GENERAL, LOG_ERR,
@@ -578,6 +690,9 @@ bool EncoderLink::GetKeyframePositions(
  */
 void EncoderLink::FrontendReady(void)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->FrontendReady();
     else
@@ -594,10 +709,17 @@ void EncoderLink::FrontendReady(void)
  */
 void EncoderLink::CancelNextRecording(bool cancel)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->CancelNextRecording(cancel);
     else
-        sock->CancelNextRecording(m_capturecardnum, cancel);
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            sock->CancelNextRecording(m_capturecardnum, cancel);
+    }
 }
 
 /** \fn EncoderLink::SpawnLiveTV(LiveTVChain*, bool, QString)
@@ -613,6 +735,9 @@ void EncoderLink::CancelNextRecording(bool cancel)
  */
 void EncoderLink::SpawnLiveTV(LiveTVChain *chain, bool pip, QString startchan)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->SpawnLiveTV(chain, pip, startchan);
     else
@@ -624,6 +749,9 @@ void EncoderLink::SpawnLiveTV(LiveTVChain *chain, bool pip, QString startchan)
  */
 QString EncoderLink::GetChainID(void)
 {
+    if (disconnected)
+        return "";
+
     if (local)
         return tv->GetChainID();
 
@@ -638,6 +766,9 @@ QString EncoderLink::GetChainID(void)
  */
 void EncoderLink::StopLiveTV(void)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->StopLiveTV();
     else
@@ -652,6 +783,9 @@ void EncoderLink::StopLiveTV(void)
  */
 void EncoderLink::PauseRecorder(void)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->PauseRecorder();
     else
@@ -665,6 +799,9 @@ void EncoderLink::PauseRecorder(void)
  */
 void EncoderLink::SetLiveRecording(int recording)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->SetLiveRecording(recording);
     else
@@ -677,10 +814,17 @@ void EncoderLink::SetLiveRecording(int recording)
  */
 void EncoderLink::SetNextLiveTVDir(QString dir)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->SetNextLiveTVDir(dir);
     else
-        sock->SetNextLiveTVDir(m_capturecardnum, dir);
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            sock->SetNextLiveTVDir(m_capturecardnum, dir);
+    }
 }
 
 /** \fn EncoderLink::GetFreeInputs(const vector<uint>&) const
@@ -689,14 +833,21 @@ void EncoderLink::SetNextLiveTVDir(QString dir)
  *  \sa TVRec::GetFreeInputs(const vector<uint>&) const
  */
 vector<InputInfo> EncoderLink::GetFreeInputs(
-    const vector<uint> &excluded_cardids) const
+    const vector<uint> &excluded_cardids)
 {
     vector<InputInfo> list;
 
+    if (disconnected)
+        return list;
+
     if (local)
         list = tv->GetFreeInputs(excluded_cardids);
     else
-        list = sock->GetFreeInputs(m_capturecardnum, excluded_cardids);
+    {
+        QMutexLocker locker(&sockLock);
+        if (sock)
+            list = sock->GetFreeInputs(m_capturecardnum, excluded_cardids);
+    }
 
     return list;
 }
@@ -709,6 +860,9 @@ vector<InputInfo> EncoderLink::GetFreeInputs(
  */
 QString EncoderLink::GetInput(void) const
 {
+    if (disconnected)
+        return QString();
+
     if (local)
         return tv->GetInput();
 
@@ -728,6 +882,9 @@ QString EncoderLink::GetInput(void) const
  */
 QString EncoderLink::SetInput(QString input)
 {
+    if (disconnected)
+        return QString();
+
     if (local)
         return tv->SetInput(input);
 
@@ -742,6 +899,9 @@ QString EncoderLink::SetInput(QString input)
  */
 void EncoderLink::ToggleChannelFavorite(QString changroup)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->ToggleChannelFavorite(changroup);
     else
@@ -757,6 +917,9 @@ void EncoderLink::ToggleChannelFavorite(QString changroup)
  */
 void EncoderLink::ChangeChannel(ChannelChangeDirection channeldirection)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->ChangeChannel(channeldirection);
     else
@@ -772,6 +935,9 @@ void EncoderLink::ChangeChannel(ChannelChangeDirection channeldirection)
  */
 void EncoderLink::SetChannel(const QString &name)
 {
+    if (disconnected)
+        return;
+
     if (local)
         tv->SetChannel(name);
     else
@@ -788,6 +954,9 @@ void EncoderLink::SetChannel(const QString &name)
  */
 int EncoderLink::GetPictureAttribute(PictureAttribute attr)
 {
+    if (disconnected)
+        return -1;
+
     if (!local)
     {
         LOG(VB_GENERAL, LOG_ERR,
@@ -810,6 +979,9 @@ int EncoderLink::ChangePictureAttribute(PictureAdjustType type,
                                         PictureAttribute  attr,
                                         bool              direction)
 {
+    if (disconnected)
+        return -1;
+
     if (!local)
     {
         LOG(VB_GENERAL, LOG_ERR,
@@ -831,6 +1003,9 @@ int EncoderLink::ChangePictureAttribute(PictureAdjustType type,
  */
 bool EncoderLink::CheckChannel(const QString &name)
 {
+    if (disconnected)
+        return false;
+
     if (local)
         return tv->CheckChannel(name);
 
@@ -849,6 +1024,9 @@ bool EncoderLink::CheckChannel(const QString &name)
  */
 bool EncoderLink::ShouldSwitchToAnotherCard(const QString &channelid)
 {
+    if (disconnected)
+        return false;
+
     if (local)
         return tv->ShouldSwitchToAnotherCard(channelid);
 
@@ -870,6 +1048,9 @@ bool EncoderLink::CheckChannelPrefix(
     bool          &is_extra_char_useful,
     QString       &needed_spacer)
 {
+    if (disconnected)
+        return false;
+
     if (local)
     {
         return tv->CheckChannelPrefix(
@@ -897,6 +1078,9 @@ void EncoderLink::GetNextProgram(BrowseDirection direction,
                                  QString &channelname, uint    &_chanid,
                                  QString &seriesid,    QString &programid)
 {
+    if (disconnected)
+        return;
+
     if (local)
     {
         tv->GetNextProgram(direction,
@@ -912,6 +1096,9 @@ bool EncoderLink::GetChannelInfo(uint &chanid, uint &sourceid,
                                  QString &callsign, QString &channum,
                                  QString &channame, QString &xmltv) const
 {
+    if (disconnected)
+        return false;
+
     if (!local)
     {
         LOG(VB_GENERAL, LOG_ERR, "Should be local only query: GetChannelInfo");
@@ -927,6 +1114,9 @@ bool EncoderLink::SetChannelInfo(uint chanid, uint sourceid,
                                  QString callsign, QString channum,
                                  QString channame, QString xmltv)
 {
+    if (disconnected)
+        return false;
+
     if (!local)
     {
         LOG(VB_GENERAL, LOG_ERR, "Should be local only query: SetChannelInfo");
diff --git a/mythtv/programs/mythbackend/encoderlink.h b/mythtv/programs/mythbackend/encoderlink.h
index 09eaae1..2729eee 100644
--- a/mythtv/programs/mythbackend/encoderlink.h
+++ b/mythtv/programs/mythbackend/encoderlink.h
@@ -3,6 +3,7 @@
 
 #include <QString>
 #include <QMap>
+#include <QMutex>
 
 #include "tv.h"
 #include "programinfo.h"
@@ -23,6 +24,9 @@ class EncoderLink
 
     /// \brief Used to set the socket for a non-local EncoderLink.
     void SetSocket(PlaybackSock *lsock);
+
+    void Disconnect();
+
     /// \brief Returns the socket, if set, for a non-local EncoderLink.
     PlaybackSock *GetSocket(void) { return sock; }
 
@@ -42,7 +46,16 @@ class EncoderLink
     /// \brief Returns true for a local EncoderLink.
     bool IsLocal(void) const { return local; }
     /// \brief Returns true if the EncoderLink instance is usable.
-    bool IsConnected(void) const { return (IsLocal() || sock!=NULL); }
+    bool IsConnected(void) { bool value;
+                             if (disconnected)
+                                 return false;
+                             value = IsLocal();
+                             if (value)
+                                 return value;
+                             if (sock)
+                                 return true;
+                             return false;
+                           }
     /// \brief Returns true if the encoder is awake.
     bool IsAwake(void) const { return (sleepStatus == sStatus_Awake); }
     /// \brief Returns true if the encoder is asleep.
@@ -82,7 +95,7 @@ class EncoderLink
     bool IsBusyRecording(void);
 
     TVState GetState();
-    uint GetFlags(void) const;
+    uint GetFlags(void);
     bool IsRecording(const ProgramInfo *rec); // scheduler call only.
 
     bool MatchesRecording(const ProgramInfo *rec);
@@ -108,7 +121,7 @@ class EncoderLink
     void PauseRecorder(void);
     void SetLiveRecording(int);
     void SetNextLiveTVDir(QString dir);
-    vector<InputInfo> GetFreeInputs(const vector<uint> &excluded_cards) const;
+    vector<InputInfo> GetFreeInputs(const vector<uint> &excluded_cards);
     QString GetInput(void) const;
     QString SetInput(QString);
     void ToggleChannelFavorite(QString);
@@ -138,7 +151,10 @@ class EncoderLink
   private:
     int m_capturecardnum;
 
+    QMutex sockLock;
+
     PlaybackSock *sock;
+
     QString hostname;
 
     long long freeDiskSpaceKB;
@@ -147,6 +163,7 @@ class EncoderLink
 
     bool local;
     bool locked;
+    bool disconnected;
 
     SleepStatus sleepStatus;
     QDateTime sleepStatusTime;
diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
index ba1fbc5..e4c5fd2 100644
--- a/mythtv/programs/mythbackend/mainserver.cpp
+++ b/mythtv/programs/mythbackend/mainserver.cpp
@@ -5749,7 +5749,8 @@ void MainServer::connectionClosed(MythSocket *socket)
                         if (!elink->IsFallingAsleep())
                             isFallingAsleep = false;
 
-                        elink->SetSocket(NULL);
+                        // elink->SetSocket(NULL);
+                        elink->Disconnect();
                         if (m_sched)
                             disconnectedSlaves.push_back(elink->GetCardID());
                     }
diff --git a/mythtv/programs/mythbackend/playbacksock.cpp b/mythtv/programs/mythbackend/playbacksock.cpp
index 30b76063..e91639d 100644
--- a/mythtv/programs/mythbackend/playbacksock.cpp
+++ b/mythtv/programs/mythbackend/playbacksock.cpp
@@ -17,7 +17,8 @@ using namespace std;
 PlaybackSock::PlaybackSock(
     MainServer *parent, MythSocket *lsock,
     QString lhostname, PlaybackSockEventsMode eventsMode) :
-    ReferenceCounter("PlaybackSock")
+    ReferenceCounter("PlaybackSock"),
+    sockLock(QMutex::Recursive)
 {
     m_parent = parent;
     QString localhostname = gCoreContext->GetHostName();
@@ -77,11 +78,29 @@ bool PlaybackSock::SendReceiveStringList(
 {
     bool ok = false;
 
+    QMutexLocker locker(&sockLock);
+
+    if (!sock)
+        return false;
+
     sock->IncrRef();
-    sock->Lock();
+
+    unsigned int loop=5;
+    while ((sock->TryLock(false) == false) && (loop > 0))
+    {
+        --loop;
+        locker.unlock();
+        usleep(10000); 
+    }
+    locker.relock();
+
+    if (!sock)
+    {
+        sock->IncrRef();
+        return false;
+    }
 
     {
-        QMutexLocker locker(&sockLock);
         expectingreply = true;
 
         sock->writeStringList(strlist);
@@ -322,6 +341,10 @@ bool PlaybackSock::IsBusy(int capturecardnum, InputInfo *busy_input,
 {
     QStringList strlist(QString("QUERY_REMOTEENCODER %1").arg(capturecardnum));
 
+    QMutexLocker locker(&sockLock);
+    if (disconnected)
+        return true;
+
     strlist << "IS_BUSY";
     strlist << QString::number(time_buffer);
 
diff --git a/mythtv/programs/mythbackend/playbacksock.h b/mythtv/programs/mythbackend/playbacksock.h
index c273604..a74d43b 100644
--- a/mythtv/programs/mythbackend/playbacksock.h
+++ b/mythtv/programs/mythbackend/playbacksock.h
@@ -31,7 +31,7 @@ class PlaybackSock : public ReferenceCounter
                  QString lhostname, PlaybackSockEventsMode eventsMode);
     virtual ~PlaybackSock();
 
-    void SetDisconnected(void) { disconnected = true; }
+    void SetDisconnected(void) { QMutexLocker locker(&sockLock); disconnected = true; }
     bool IsDisconnected(void) const { return disconnected; }
 
     MythSocket *getSocket(void) const { return sock; }
