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
@@ -581,6 +581,6 @@ 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));
}
@@ -856,7 +856,3 @@ tftp *p = tftp::Allocate(tftp::tftpDATA::tftpSize(m_blkSize));
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;
}
@@ -938,31 +934,31 @@ BOOL rv = TRUE;
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;
@@ -970,3 +966,11 @@ BOOL rv = TRUE;
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();
diff --git a/PumpKINDlg.h b/PumpKINDlg.h
index c5469f1..23c2657 100644
--- a/PumpKINDlg.h
+++ b/PumpKINDlg.h
@@ -314,3 +314,3 @@ public:
virtual void OnReceive(int nErrorCode);
- void DoSelect();
+ void DoSelect(BOOL do_select=FALSE);
SOCKADDR_IN m_Peer;
@@ -343,2 +343,3 @@ class CRRQSocket : public CXferSocket {
public:
+ UINT m_ACKtoClose;
void OnHostKnown();
diff --git a/pumpkin.mak b/pumpkin.mak
index a22a6fa..bf9e895 100644
--- a/pumpkin.mak
+++ b/pumpkin.mak
@@ -688,5 +688,2 @@ LINK32_OBJS= \
SOURCE=.\PumpKIN.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PUMPK=\
@@ -699,2 +696,5 @@ DEP_CPP_PUMPK=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PumpKIN.obj" : $(SOURCE) $(DEP_CPP_PUMPK) "$(INTDIR)"\
@@ -705,9 +705,2 @@ DEP_CPP_PUMPK=\
-DEP_CPP_PUMPK=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -722,9 +715,2 @@ DEP_CPP_PUMPK=\
-DEP_CPP_PUMPK=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -741,2 +727,5 @@ DEP_CPP_PUMPK=\
SOURCE=.\PumpKINDlg.cpp
+
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
DEP_CPP_PUMPKI=\
@@ -760,5 +749,2 @@ DEP_CPP_PUMPKI=\
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
-
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
@@ -769,2 +755,22 @@ DEP_CPP_PUMPKI=\
+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"\
+
@@ -779,2 +785,20 @@ DEP_CPP_PUMPKI=\
+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"\
+
@@ -988,5 +1012,2 @@ BuildCmds= \
SOURCE=.\PropsServer.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PROPS=\
@@ -999,2 +1020,5 @@ DEP_CPP_PROPS=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PropsServer.obj" : $(SOURCE) $(DEP_CPP_PROPS) "$(INTDIR)"\
@@ -1005,9 +1029,2 @@ DEP_CPP_PROPS=\
-DEP_CPP_PROPS=\
- ".\PropsServer.h"\
- ".\pumpkin.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1022,9 +1039,2 @@ DEP_CPP_PROPS=\
-DEP_CPP_PROPS=\
- ".\PropsServer.h"\
- ".\pumpkin.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1080,5 +1090,2 @@ DEP_CPP_PROPSN=\
SOURCE=.\ConfirmRRQDlg.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_CONFI=\
@@ -1092,2 +1099,5 @@ DEP_CPP_CONFI=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ConfirmRRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFI) "$(INTDIR)"\
@@ -1098,10 +1108,2 @@ DEP_CPP_CONFI=\
-DEP_CPP_CONFI=\
- ".\ConfirmRRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1116,10 +1118,2 @@ DEP_CPP_CONFI=\
-DEP_CPP_CONFI=\
- ".\ConfirmRRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1136,5 +1130,2 @@ DEP_CPP_CONFI=\
SOURCE=.\ConfirmWRQDlg.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_CONFIR=\
@@ -1148,2 +1139,5 @@ DEP_CPP_CONFIR=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ConfirmWRQDlg.obj" : $(SOURCE) $(DEP_CPP_CONFIR) "$(INTDIR)"\
@@ -1154,10 +1148,2 @@ DEP_CPP_CONFIR=\
-DEP_CPP_CONFIR=\
- ".\ConfirmWRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1172,10 +1158,2 @@ DEP_CPP_CONFIR=\
-DEP_CPP_CONFIR=\
- ".\ConfirmWRQDlg.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1231,5 +1209,2 @@ DEP_CPP_REQUE=\
SOURCE=.\Resolver.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_RESOL=\
@@ -1243,2 +1218,5 @@ DEP_CPP_RESOL=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Resolver.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"\
@@ -1249,10 +1227,2 @@ DEP_CPP_RESOL=\
-DEP_CPP_RESOL=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Resolver.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1267,10 +1237,2 @@ DEP_CPP_RESOL=\
-DEP_CPP_RESOL=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Resolver.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1287,5 +1249,2 @@ DEP_CPP_RESOL=\
SOURCE=.\Retrier.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_RETRI=\
@@ -1299,2 +1258,5 @@ DEP_CPP_RETRI=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Retrier.obj" : $(SOURCE) $(DEP_CPP_RETRI) "$(INTDIR)"\
@@ -1305,10 +1267,2 @@ DEP_CPP_RETRI=\
-DEP_CPP_RETRI=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1323,10 +1277,2 @@ DEP_CPP_RETRI=\
-DEP_CPP_RETRI=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1343,5 +1289,2 @@ DEP_CPP_RETRI=\
SOURCE=.\Trayer.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_TRAYE=\
@@ -1355,2 +1298,5 @@ DEP_CPP_TRAYE=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
@@ -1361,10 +1307,2 @@ DEP_CPP_TRAYE=\
-DEP_CPP_TRAYE=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
@@ -1379,10 +1317,2 @@ DEP_CPP_TRAYE=\
-DEP_CPP_TRAYE=\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
@@ -1419,5 +1349,2 @@ SOURCE=.\help\pumpkin.cnt
SOURCE=.\PropsSounds.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PROPSS=\
@@ -1431,2 +1358,5 @@ DEP_CPP_PROPSS=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PropsSounds.obj" : $(SOURCE) $(DEP_CPP_PROPSS) "$(INTDIR)"\
@@ -1437,10 +1367,2 @@ DEP_CPP_PROPSS=\
-DEP_CPP_PROPSS=\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1455,10 +1377,2 @@ DEP_CPP_PROPSS=\
-DEP_CPP_PROPSS=\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1516,5 +1430,2 @@ DEP_CPP_PROPSA=\
SOURCE=.\ACLTargetCombo.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_ACLTA=\
@@ -1528,2 +1439,5 @@ DEP_CPP_ACLTA=\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\ACLTargetCombo.obj" : $(SOURCE) $(DEP_CPP_ACLTA) "$(INTDIR)"\
@@ -1534,10 +1448,2 @@ DEP_CPP_ACLTA=\
-DEP_CPP_ACLTA=\
- ".\ACLTargetCombo.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
@@ -1552,10 +1458,2 @@ DEP_CPP_ACLTA=\
-DEP_CPP_ACLTA=\
- ".\ACLTargetCombo.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-