diff options
| author | 2009-04-08 23:08:35 +0000 | |
|---|---|---|
| committer | 2009-04-08 23:08:35 +0000 | |
| commit | 6dbf6d889541ba48ed9302d9ca9356c365609b5f (patch) | |
| tree | 5ac737deb61cf0bc64dc7e5e94a27c6d3c8dc6d6 /src/modules | |
| parent | small header fix when compiling without crypt-support (diff) | |
| download | KVIrc-6dbf6d889541ba48ed9302d9ca9356c365609b5f.tar.gz KVIrc-6dbf6d889541ba48ed9302d9ca9356c365609b5f.tar.bz2 KVIrc-6dbf6d889541ba48ed9302d9ca9356c365609b5f.zip | |
fix for #365
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3173 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/dcc/marshal.cpp | 51 | ||||
| -rw-r--r-- | src/modules/dcc/marshal.h | 2 | ||||
| -rw-r--r-- | src/modules/dcc/send.cpp | 5 | ||||
| -rw-r--r-- | src/modules/dcc/send.h | 4 |
4 files changed, 56 insertions, 6 deletions
diff --git a/src/modules/dcc/marshal.cpp b/src/modules/dcc/marshal.cpp index 55ad6ecfa..2a47b5b43 100644 --- a/src/modules/dcc/marshal.cpp +++ b/src/modules/dcc/marshal.cpp @@ -43,6 +43,7 @@ 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 @@ -96,6 +97,11 @@ void KviDccMarshal::reset() m_pSSL = 0; } #endif + if(m_pTimeoutTimer) + { + delete m_pTimeoutTimer; + m_pTimeoutTimer = 0; + } m_bIPv6 = false; } @@ -109,6 +115,12 @@ int KviDccMarshal::dccListen(const QString &ip,const QString &port,bool bUseTime m_bOutgoing = false; m_bUseTimeout = bUseTimeout; + + if(m_pTimeoutTimer) + { + delete m_pTimeoutTimer; + m_pTimeoutTimer = 0; + } #ifdef COMPILE_SSL_SUPPORT m_bUseSSL = bUseSSL; @@ -268,8 +280,20 @@ void KviDccMarshal::doListen() if(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) < 5) KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5; + if(m_pTimeoutTimer) + { + delete m_pTimeoutTimer; + m_pTimeoutTimer = 0; + } + if(m_bUseTimeout) - QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut())); + { + m_pTimeoutTimer = new QTimer(); + connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut())); + m_pTimeoutTimer->setSingleShot(true); + m_pTimeoutTimer->setInterval((KviOption_uintDccSocketTimeout) * 1000); + m_pTimeoutTimer->start(); + } // and wait for connect emit inProgress(); @@ -296,6 +320,11 @@ int KviDccMarshal::dccConnect(const char * ip,const char * port,bool bUseTimeout void KviDccMarshal::doConnect() { + if(m_pTimeoutTimer) + { + delete m_pTimeoutTimer; + m_pTimeoutTimer = 0; + } // Check the address type if(!KviNetUtils::isValidStringIp(m_szIp)) { @@ -392,8 +421,20 @@ void KviDccMarshal::doConnect() if(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) < 5) KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) = 5; + if(m_pTimeoutTimer) + { + delete m_pTimeoutTimer; + m_pTimeoutTimer = 0; + } + if(m_bUseTimeout) - QTimer::singleShot(KVI_OPTION_UINT(KviOption_uintDccSocketTimeout) * 1000, this, SLOT(connectionTimedOut())); + { + m_pTimeoutTimer = new QTimer(); + connect(m_pTimeoutTimer,SIGNAL(timeout()),this,SLOT(connectionTimedOut())); + m_pTimeoutTimer->setSingleShot(true); + m_pTimeoutTimer->setInterval((KviOption_uintDccSocketTimeout) * 1000); + m_pTimeoutTimer->start(); + } // and wait for connect emit inProgress(); @@ -402,6 +443,11 @@ 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 @@ -600,6 +646,7 @@ void KviDccMarshal::connectionTimedOut() { reset(); emit error(KviError_connectionTimedOut); + debug("MARSHAL"); } diff --git a/src/modules/dcc/marshal.h b/src/modules/dcc/marshal.h index e09d1f9ad..6ff568251 100644 --- a/src/modules/dcc/marshal.h +++ b/src/modules/dcc/marshal.h @@ -30,6 +30,7 @@ #include <QObject> #include <QSocketNotifier> +#include <QTimer> class KviWindow; class KviDccMarshal; @@ -70,6 +71,7 @@ protected: kvi_socket_t m_fd; // socket QSocketNotifier * m_pSn; bool m_bUseTimeout; + QTimer * m_pTimeoutTimer; #ifdef COMPILE_SSL_SUPPORT KviSSL * m_pSSL; bool m_bUseSSL; diff --git a/src/modules/dcc/send.cpp b/src/modules/dcc/send.cpp index bc9e48394..9731bd83b 100644 --- a/src/modules/dcc/send.cpp +++ b/src/modules/dcc/send.cpp @@ -1417,7 +1417,7 @@ bool KviDccFileTransfer::handleResumeAccepted(const char * filename,const char * return false; } -bool KviDccFileTransfer::handleResumeRequest(const char * filename,const char * port,unsigned int filePos) +bool KviDccFileTransfer::handleResumeRequest(const char * filename,const char * port,unsigned long filePos) { if(!g_pDccFileTransfers)return false; @@ -1630,6 +1630,7 @@ bool KviDccFileTransfer::event(QEvent *e) outputAndLog(m_szStatusString); m_eGeneralStatus = Success; m_tTransferEndTime = kvi_unixTime(); + if (m_pResumeTimer) delete m_pResumeTimer; KVS_TRIGGER_EVENT_2(KviEvent_OnDCCFileTransferSuccess, eventWindow(), @@ -1763,7 +1764,7 @@ bool KviDccFileTransfer::resumeAccepted(const char *filename,const char *port,co return true; } -bool KviDccFileTransfer::doResume(const char * filename,const char * port,unsigned int filePos) +bool KviDccFileTransfer::doResume(const char * filename,const char * port,unsigned long filePos) { if(KviQString::equalCI(port,m_pMarshal->dccPort()) && (!m_pSlaveRecvThread) && (!m_pDescriptor->bRecvFile)) diff --git a/src/modules/dcc/send.h b/src/modules/dcc/send.h index d5a7d0bbd..647b060cb 100644 --- a/src/modules/dcc/send.h +++ b/src/modules/dcc/send.h @@ -199,7 +199,7 @@ private: QTimer * m_pResumeTimer; // used to signal resume timeout public: bool resumeAccepted(const char * filename,const char * port,const char *szZeroPortTag); - bool doResume(const char * filename,const char * port,unsigned int filePos); + bool doResume(const char * filename,const char * port,unsigned long filePos); static void init(); static void done(); @@ -207,7 +207,7 @@ public: static KviDccFileTransfer * nonFailedTransferWithLocalFileName(const QString &szLocalFileName); static unsigned int transferCount(); static bool handleResumeAccepted(const char * filename,const char * port,const char * szZeroPortTag); - static bool handleResumeRequest(const char * filename,const char * port,unsigned int filePos); + static bool handleResumeRequest(const char * filename,const char * port,unsigned long filePos); virtual bool event(QEvent *e); |
