00001
00002 using namespace std;
00003
00004 #include <QStringList>
00005
00006 #include "sockethandler.h"
00007 #include "mythlogging.h"
00008
00009 SocketHandler::SocketHandler(MythSocket *sock, MythSocketManager *parent,
00010 QString hostname) :
00011 ReferenceCounter(), m_blockShutdown(false), m_standardEvents(false),
00012 m_systemEvents(false), m_socket(sock), m_parent(parent),
00013 m_hostname(hostname)
00014 {
00015 m_socket->UpRef();
00016 }
00017
00018 SocketHandler::~SocketHandler()
00019 {
00020 if (m_socket)
00021 m_socket->DownRef();
00022 }
00023
00024 bool SocketHandler::SendStringList(QStringList &strlist, bool lock)
00025 {
00026 if (!m_socket)
00027 return false;
00028
00029 LOG(VB_GENERAL, LOG_DEBUG, "Locking Socket for write");
00030 if (lock) m_socket->Lock();
00031 bool res = m_socket->writeStringList(strlist);
00032 if (lock) m_socket->Unlock();
00033 LOG(VB_GENERAL, LOG_DEBUG, "UnLocking Socket from write");
00034
00035 return res;
00036 }
00037
00038 bool SocketHandler::SendReceiveStringList(QStringList &strlist,
00039 uint min_reply_length)
00040 {
00041 if (!m_socket)
00042 return false;
00043
00044 return m_socket->SendReceiveStringList(strlist, min_reply_length);
00045 }