[Ttssh2-commit] [6249] XMODEM 送信時のリモートからのキャンセルに対応

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2016年 1月 5日 (火) 20:44:33 JST


Revision: 6249
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6249
Author:   doda
Date:     2016-01-05 20:44:33 +0900 (Tue, 05 Jan 2016)
Log Message:
-----------
XMODEM 送信時のリモートからのキャンセルに対応

Modified Paths:
--------------
    trunk/teraterm/common/ttftypes.h
    trunk/teraterm/ttpfile/xmodem.c

-------------- next part --------------
Modified: trunk/teraterm/common/ttftypes.h
===================================================================
--- trunk/teraterm/common/ttftypes.h	2016-01-05 09:41:24 UTC (rev 6248)
+++ trunk/teraterm/common/ttftypes.h	2016-01-05 11:44:33 UTC (rev 6249)
@@ -185,6 +185,7 @@
   BOOL CRRecv;
   int TOutShort;
   int TOutLong;
+  int CANCount;
 } TXVar;
 typedef TXVar far *PXVar;
 

Modified: trunk/teraterm/ttpfile/xmodem.c
===================================================================
--- trunk/teraterm/ttpfile/xmodem.c	2016-01-05 09:41:24 UTC (rev 6248)
+++ trunk/teraterm/ttpfile/xmodem.c	2016-01-05 11:44:33 UTC (rev 6249)
@@ -190,6 +190,7 @@
 	xv->PktNumSent = 0;
 	xv->PktBufCount = 0;
 	xv->CRRecv = FALSE;
+	xv->CANCount = 0;
 
 	fv->ByteCount = 0;
 
@@ -399,8 +400,7 @@
 
 	SendFlag = FALSE;
 	if (xv->PktBufCount == 0) {
-		i = XRead1Byte(fv, xv, cv, &b);
-		do {
+		for (i=XRead1Byte(fv, xv, cv, &b); !SendFlag; i=XRead1Byte(fv, xv, cv, &b)) {
 			if (i == 0)
 				return TRUE;
 			switch (b) {
@@ -429,6 +429,14 @@
 				SendFlag = TRUE;
 				break;
 			case CAN:
+				xv->CANCount++;
+				if (xv->CANCount <= 2) {
+					continue;
+				}
+				else {
+					fv->Success = TRUE;
+					return FALSE;
+				}
 				break;
 			case 0x43:
 				if ((xv->PktNum == 0) && (xv->PktNumOffset == 0) && (xv->PktNumSent == 0)) {
@@ -438,9 +446,8 @@
 				}
 				break;
 			}
-			if (!SendFlag)
-				i = XRead1Byte(fv, xv, cv, &b);
-		} while (!SendFlag);
+			xv->CANCount = 0;
+		}
 		// reset timeout timer
 		FTSetTimeOut(fv, TimeOutVeryLong);
 



Ttssh2-commit メーリングリストの案内
Back to archive index