aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/dcc/marshal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/dcc/marshal.cpp')
-rw-r--r--src/modules/dcc/marshal.cpp54
1 files changed, 5 insertions, 49 deletions
diff --git a/src/modules/dcc/marshal.cpp b/src/modules/dcc/marshal.cpp
index 5f6aa6b3b..628889e45 100644
--- a/src/modules/dcc/marshal.cpp
+++ b/src/modules/dcc/marshal.cpp
@@ -33,6 +33,7 @@
#include <stdlib.h> //for exit()
+#include <QTimer>
KviDccMarshal::KviDccMarshal(KviDccMarshalOutputContext * ctx)
: QObject(0)
@@ -40,7 +41,6 @@ KviDccMarshal::KviDccMarshal(KviDccMarshalOutputContext * ctx)
setObjectName("dcc_marshal");
m_pSn = 0;
m_fd = KVI_INVALID_SOCKET;
- m_pTimeoutTimer = 0;
m_bIPv6 = false;
m_pOutputContext = ctx;
#ifdef COMPILE_SSL_SUPPORT
@@ -94,11 +94,6 @@ void KviDccMarshal::reset()
m_pSSL = 0;
}
#endif
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
m_bIPv6 = false;
}
@@ -118,25 +113,13 @@ int KviDccMarshal::dccListen(const QString &ip,const QString &port,bool bUseTime
#else
if(bUseSSL)return KviError_noSSLSupport;
#endif
-
- if(m_pTimeoutTimer)delete m_pTimeoutTimer;
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(doListen()));
-// m_pTimeoutTimer->start(100,true);
- m_pTimeoutTimer->setInterval(199);
- m_pTimeoutTimer->setSingleShot(true);
+ QTimer::singleShot(100, this, SLOT(doListen()));
return KviError_success;
}
void KviDccMarshal::doListen()
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
// Check the address type
if(!kvi_isValidStringIp(m_szIp.toUtf8().data()))
{
@@ -284,13 +267,7 @@ void KviDccMarshal::doListen()
KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5;
if(m_bUseTimeout)
- {
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut()));
- //m_pTimeoutTimer->start(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000,true);
- m_pTimeoutTimer->setInterval(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000);
- m_pTimeoutTimer->setSingleShot(true);
- }
+ QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut()));
// and wait for connect
emit inProgress();
@@ -311,23 +288,12 @@ int KviDccMarshal::dccConnect(const char * ip,const char * port,bool bUseTimeout
if(bUseSSL)return KviError_noSSLSupport;
#endif
- if(m_pTimeoutTimer)delete m_pTimeoutTimer;
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(doConnect()));
-// m_pTimeoutTimer->start(100,true);
- m_pTimeoutTimer->setInterval(100);
- m_pTimeoutTimer->setSingleShot(true);
+ QTimer::singleShot(100, this, SLOT(doConnect()));
return KviError_success;
}
void KviDccMarshal::doConnect()
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
// Check the address type
if(!kvi_isValidStringIp(m_szIp.toUtf8().data()))
{
@@ -425,11 +391,7 @@ void KviDccMarshal::doConnect()
KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5;
if(m_bUseTimeout)
- {
- m_pTimeoutTimer = new QTimer();
- connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut()));
- m_pTimeoutTimer->start(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000,true);
- }
+ QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut()));
// and wait for connect
emit inProgress();
@@ -438,12 +400,6 @@ void KviDccMarshal::doConnect()
void KviDccMarshal::snActivated(int)
{
- if(m_pTimeoutTimer)
- {
- delete m_pTimeoutTimer;
- m_pTimeoutTimer = 0;
- }
-
#ifdef COMPILE_IPV6_SUPPORT
struct sockaddr_in6 hostSockAddr6;
#endif