Skip to content

Commit 79b4799

Browse files
committed
受信データの最後0.25秒間に受信したバイト数が、受信中ダイアログの転送済容量に反映されない場合がある不具合を修正した #894
1 parent 92c3cfc commit 79b4799

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

teraterm/ttpfile/raw.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ typedef struct {
4848
TComm *Comm;
4949
PFileVarProto fv;
5050
TFileIO *file;
51-
int AutostopSec; // 自動停止待ち時間(秒)
51+
int AutoStopSec; // 自動停止待ち時間(秒)
52+
int SecLeft;
5253
} TRawVar;
5354
typedef TRawVar *PRawVar;
5455

@@ -121,14 +122,21 @@ static void RawTimeOutProc(TProto *pv)
121122
TFileIO *file = rv->file;
122123
PFileVarProto fv = rv->fv;
123124

124-
rv->state = STATE_CANCELED; // quit(autostop)
125-
file->Close(file);
126-
if (! cv->Ready) {
127-
// セッション断の場合は RawParse() が呼ばれないため、直接 ProtoEnd() を呼ぶ
128-
RawFlushReceiveBuf(rv);
129-
ProtoEnd();
130-
} else {
131-
fv->Success = TRUE;
125+
rv->SecLeft -= 1;
126+
if (rv->AutoStopSec > 0 && rv->SecLeft == 0) {
127+
rv->state = STATE_CANCELED; // quit(autostop)
128+
file->Close(file);
129+
if (! cv->Ready) {
130+
// セッション断の場合は RawParse() が呼ばれないため、直接 ProtoEnd() を呼ぶ
131+
RawFlushReceiveBuf(rv);
132+
ProtoEnd();
133+
} else {
134+
fv->Success = TRUE;
135+
}
136+
}
137+
else {
138+
fv->InfoOp->SetDlgByteCount(fv, rv->ByteCount);
139+
fv->FTSetTimeOut(fv, 1);
132140
}
133141
}
134142

@@ -163,8 +171,9 @@ static BOOL RawReadPacket(void *arg)
163171
prev_elapsed = elapsed;
164172
fv->InfoOp->SetDlgByteCount(fv, rv->ByteCount);
165173
fv->InfoOp->SetDlgTime(fv, rv->StartTime, rv->ByteCount);
166-
fv->FTSetTimeOut(fv, rv->AutostopSec);
167174
}
175+
rv->SecLeft = rv->AutoStopSec;
176+
fv->FTSetTimeOut(fv, 1);
168177
}
169178
if (rv->state == STATE_CANCELED) {
170179
return FALSE;
@@ -196,7 +205,7 @@ static int SetOptV(TProto *pv, int request, va_list ap)
196205
switch(request) {
197206
case RAW_AUTOSTOP_SEC: {
198207
const int autostop_sec = va_arg(ap, int);
199-
rv->AutostopSec = autostop_sec;
208+
rv->AutoStopSec = autostop_sec;
200209
return 0;
201210
}
202211
}

0 commit comments

Comments
 (0)