summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-07-02 22:16:25 (UTC)
committer Michael Krelin <hacker@klever.net>2006-07-02 22:16:25 (UTC)
commit577427e68ef10a4d2b75d28e42b22952ae3bcf23 (patch) (side-by-side diff)
tree24c8fc94ea6524059cab7927ef76639bb1a1a98d
parent24e693797daef020ece3fa19bb5acce000e37165 (diff)
downloadpumpkin-577427e68ef10a4d2b75d28e42b22952ae3bcf23.zip
pumpkin-577427e68ef10a4d2b75d28e42b22952ae3bcf23.tar.gz
pumpkin-577427e68ef10a4d2b75d28e42b22952ae3bcf23.tar.bz2
Do not close RRQ socket until the last ACK is received.
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@152 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--PumpKINDlg.cpp70
-rw-r--r--PumpKINDlg.h3
-rw-r--r--pumpkin.mak238
3 files changed, 107 insertions, 204 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index 070f3e8..2a01918 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -580,8 +580,8 @@ int rv = socket->SendTo(udpBase(),length,(SOCKADDR*)saddr,sizeof(SOCKADDR_IN));
}
-void CXferSocket::DoSelect()
+void CXferSocket::DoSelect(BOOL do_select)
{
if(m_Peer.sin_addr.s_addr!=INADDR_NONE)
- AsyncSelect(FD_CLOSE|FD_READ|(m_Queue.IsEmpty()?0:FD_WRITE));
+ AsyncSelect(FD_CLOSE|FD_READ|((m_Queue.IsEmpty()&&!do_select)?0:FD_WRITE));
}
@@ -855,9 +855,5 @@ tftp *p = tftp::Allocate(tftp::tftpDATA::tftpSize(m_blkSize));
PostTFTP(p);
if(bytes<m_blkSize){
- state=stateFinish;
- ASSERT(m_Daddy);
- CString tmp;
- tmp.Format(IDS_LOG_XFERRRQFINISHED,(LPCTSTR)m_FileName);
- m_Daddy->LogLine(tmp);
+ state=stateClosing; m_ACKtoClose = m_ACK+1;
}
}CATCH(CFileException,e){
@@ -937,37 +933,45 @@ BOOL rv = TRUE;
switch(p->Opcode()){
case tftp::opOACK:
- m_ACK=0;
- ASSERT(state!=stateFinish);
- {
- tftp::tftpOptions o;
- if(p->GetOptions(&o)){
- CString v;
- if(o.Lookup(tftpoBSize,v)){
- m_blkSize=atoi(v);
- if(!m_blkSize){ // *** More sanity checks
- Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE);
- rv = TRUE;
- break;
+ {
+ m_ACK=0;
+ ASSERT(state!=stateFinish);
+ tftp::tftpOptions o;
+ if(p->GetOptions(&o)){
+ CString v;
+ if(o.Lookup(tftpoBSize,v)){
+ m_blkSize=atoi(v);
+ if(!m_blkSize){ // *** More sanity checks
+ Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE);
+ rv = TRUE;
+ break;
+ }
}
- }
- if(o.Lookup(tftpoTOut,v)){
- m_timeOut=atoi(v);
- if(!m_timeOut){ // *** More sanity checks
- Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT);
- rv = TRUE;
- break;
+ if(o.Lookup(tftpoTOut,v)){
+ m_timeOut=atoi(v);
+ if(!m_timeOut){ // *** More sanity checks
+ Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT);
+ rv = TRUE;
+ break;
+ }
+ }
+ if(o.Lookup(tftpoXResume,v)){
+ m_ACK=atoi(v);
}
}
- if(o.Lookup(tftpoXResume,v)){
- m_ACK=atoi(v);
- }
+ UpdateList();
+ DoXfer();
}
- UpdateList();
- DoXfer();
- }
break;
case tftp::opACK:
m_ACK=p->data.m_ACK.Block();
- if(state!=stateFinish){
+ if(state==stateClosing && m_ACK==m_ACKtoClose) {
+ state = stateFinish;
+ ASSERT(m_Daddy);
+ CString tmp;
+ tmp.Format(IDS_LOG_XFERRRQFINISHED,(LPCTSTR)m_FileName);
+ m_Daddy->LogLine(tmp);
+ rv = FALSE;
+ DoSelect(TRUE);
+ }else if(state!=stateFinish){
UpdateList();
DoXfer();
diff --git a/PumpKINDlg.h b/PumpKINDlg.h
index c5469f1..23c2657 100644
--- a/PumpKINDlg.h
+++ b/PumpKINDlg.h
@@ -313,5 +313,5 @@ public:
virtual BOOL OnTFTP(tftp* p) = 0;
virtual void OnReceive(int nErrorCode);
- void DoSelect();
+ void DoSelect(BOOL do_select=FALSE);
SOCKADDR_IN m_Peer;
virtual void OnSend(int nErrorCode);
@@ -342,4 +342,5 @@ public:
class CRRQSocket : public CXferSocket {
public:
+ UINT m_ACKtoClose;
void OnHostKnown();
virtual void OnResolved();
diff --git a/pumpkin.mak b/pumpkin.mak
index a22a6fa..bf9e895 100644
--- a/pumpkin.mak
+++ b/pumpkin.mak
@@ -687,7 +687,4 @@ LINK32_OBJS= \
SOURCE=.\PumpKIN.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PUMPK=\
".\pumpkin.h"\
@@ -698,4 +695,7 @@ DEP_CPP_PUMPK=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PumpKIN.obj" : $(SOURCE) $(DEP_CPP_PUMPK) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -704,11 +704,4 @@ DEP_CPP_PUMPK=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_PUMPK=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PumpKIN.obj" : $(SOURCE) $(DEP_CPP_PUMPK) "$(INTDIR)"\
@@ -721,11 +714,4 @@ DEP_CPP_PUMPK=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_PUMPK=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PumpKIN.obj" : $(SOURCE) $(DEP_CPP_PUMPK) "$(INTDIR)"\
@@ -740,4 +726,7 @@ DEP_CPP_PUMPK=\
SOURCE=.\PumpKINDlg.cpp
+
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
DEP_CPP_PUMPKI=\
".\ACLTargetCombo.h"\
@@ -759,7 +748,4 @@ DEP_CPP_PUMPKI=\
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
-
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -768,4 +754,24 @@ DEP_CPP_PUMPKI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
+DEP_CPP_PUMPKI=\
+ ".\ACLTargetCombo.h"\
+ ".\ConfirmRRQDlg.h"\
+ ".\ConfirmWRQDlg.h"\
+ ".\PropsACL.h"\
+ ".\PropsNetwork.h"\
+ ".\PropsServer.h"\
+ ".\PropsSounds.h"\
+ ".\pumpkin.h"\
+ ".\PumpKINDlg.h"\
+ ".\RequestDlg.h"\
+ ".\Resolver.h"\
+ ".\Retrier.h"\
+ ".\shared-code\kHelpers.h"\
+ ".\stdafx.h"\
+ ".\Trayer.h"\
+
+NODEP_CPP_PUMPKI=\
+ ".\DoSelect"\
+
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
@@ -778,4 +784,22 @@ DEP_CPP_PUMPKI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
+DEP_CPP_PUMPKI=\
+ ".\ACLTargetCombo.h"\
+ ".\ConfirmRRQDlg.h"\
+ ".\ConfirmWRQDlg.h"\
+ ".\PropsACL.h"\
+ ".\PropsNetwork.h"\
+ ".\PropsServer.h"\
+ ".\PropsSounds.h"\
+ ".\pumpkin.h"\
+ ".\PumpKINDlg.h"\
+ ".\RequestDlg.h"\
+ ".\Resolver.h"\
+ ".\Retrier.h"\
+ ".\shared-code\BellsNWhistles.h"\
+ ".\shared-code\kHelpers.h"\
+ ".\stdafx.h"\
+ ".\Trayer.h"\
+
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
@@ -987,7 +1011,4 @@ BuildCmds= \
SOURCE=.\PropsServer.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PROPS=\
".\PropsServer.h"\
@@ -998,4 +1019,7 @@ DEP_CPP_PROPS=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PropsServer.obj" : $(SOURCE) $(DEP_CPP_PROPS) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1004,11 +1028,4 @@ DEP_CPP_PROPS=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_PROPS=\
- ".\PropsServer.h"\
- ".\pumpkin.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsServer.obj" : $(SOURCE) $(DEP_CPP_PROPS) "$(INTDIR)"\
@@ -1021,11 +1038,4 @@ DEP_CPP_PROPS=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_PROPS=\
- ".\PropsServer.h"\
- ".\pumpkin.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsServer.obj" : $(SOURCE) $(DEP_CPP_PROPS) "$(INTDIR)"\
@@ -1079,7 +1089,4 @@ DEP_CPP_PROPSN=\
SOURCE=.\ConfirmRRQDlg.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_CONFI=\
".\ConfirmRRQDlg.h"\
@@ -1091,4 +1098,7 @@ DEP_CPP_CONFI=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ConfirmRRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1097,12 +1107,4 @@ DEP_CPP_CONFI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_CONFI=\
- ".\ConfirmRRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ConfirmRRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFI) "$(INTDIR)"\
@@ -1115,12 +1117,4 @@ DEP_CPP_CONFI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_CONFI=\
- ".\ConfirmRRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ConfirmRRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFI) "$(INTDIR)"\
@@ -1135,7 +1129,4 @@ DEP_CPP_CONFI=\
SOURCE=.\ConfirmWRQDlg.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_CONFIR=\
".\ConfirmWRQDlg.h"\
@@ -1147,4 +1138,7 @@ DEP_CPP_CONFIR=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ConfirmWRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFIR) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1153,12 +1147,4 @@ DEP_CPP_CONFIR=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_CONFIR=\
- ".\ConfirmWRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ConfirmWRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFIR) "$(INTDIR)"\
@@ -1171,12 +1157,4 @@ DEP_CPP_CONFIR=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_CONFIR=\
- ".\ConfirmWRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ConfirmWRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFIR) "$(INTDIR)"\
@@ -1230,7 +1208,4 @@ DEP_CPP_REQUE=\
SOURCE=.\Resolver.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_RESOL=\
".\pumpkin.h"\
@@ -1242,4 +1217,7 @@ DEP_CPP_RESOL=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Resolver.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1248,12 +1226,4 @@ DEP_CPP_RESOL=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_RESOL=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Resolver.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\Resolver.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"\
@@ -1266,12 +1236,4 @@ DEP_CPP_RESOL=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_RESOL=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Resolver.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\Resolver.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"\
@@ -1286,7 +1248,4 @@ DEP_CPP_RESOL=\
SOURCE=.\Retrier.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_RETRI=\
".\pumpkin.h"\
@@ -1298,4 +1257,7 @@ DEP_CPP_RETRI=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Retrier.obj" : $(SOURCE) $(DEP_CPP_RETRI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1304,12 +1266,4 @@ DEP_CPP_RETRI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_RETRI=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\Retrier.obj" : $(SOURCE) $(DEP_CPP_RETRI) "$(INTDIR)"\
@@ -1322,12 +1276,4 @@ DEP_CPP_RETRI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_RETRI=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\Retrier.obj" : $(SOURCE) $(DEP_CPP_RETRI) "$(INTDIR)"\
@@ -1342,7 +1288,4 @@ DEP_CPP_RETRI=\
SOURCE=.\Trayer.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_TRAYE=\
".\pumpkin.h"\
@@ -1354,4 +1297,7 @@ DEP_CPP_TRAYE=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1360,12 +1306,4 @@ DEP_CPP_TRAYE=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_TRAYE=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
@@ -1378,12 +1316,4 @@ DEP_CPP_TRAYE=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_TRAYE=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
@@ -1418,7 +1348,4 @@ SOURCE=.\help\pumpkin.cnt
SOURCE=.\PropsSounds.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PROPSS=\
".\PropsSounds.h"\
@@ -1430,4 +1357,7 @@ DEP_CPP_PROPSS=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PropsSounds.obj" : $(SOURCE) $(DEP_CPP_PROPSS) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1436,12 +1366,4 @@ DEP_CPP_PROPSS=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_PROPSS=\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsSounds.obj" : $(SOURCE) $(DEP_CPP_PROPSS) "$(INTDIR)"\
@@ -1454,12 +1376,4 @@ DEP_CPP_PROPSS=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_PROPSS=\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsSounds.obj" : $(SOURCE) $(DEP_CPP_PROPSS) "$(INTDIR)"\
@@ -1515,7 +1429,4 @@ DEP_CPP_PROPSA=\
SOURCE=.\ACLTargetCombo.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_ACLTA=\
".\ACLTargetCombo.h"\
@@ -1527,4 +1438,7 @@ DEP_CPP_ACLTA=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ACLTargetCombo.obj" : $(SOURCE) $(DEP_CPP_ACLTA) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1533,12 +1447,4 @@ DEP_CPP_ACLTA=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_ACLTA=\
- ".\ACLTargetCombo.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ACLTargetCombo.obj" : $(SOURCE) $(DEP_CPP_ACLTA) "$(INTDIR)"\
@@ -1551,12 +1457,4 @@ DEP_CPP_ACLTA=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_ACLTA=\
- ".\ACLTargetCombo.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\ACLTargetCombo.obj" : $(SOURCE) $(DEP_CPP_ACLTA) "$(INTDIR)"\