• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revisiónd5878fa6cb48dc4d50810d608f13cc8128c1331b (tree)
Tiempo2012-09-06 17:50:44
Autors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Add conditions to send dummy commands for keep alive.
Set the interval of dummy commands to 60 seconds by default.

Cambiar Resumen

Diferencia incremental

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/common.h
+++ b/common.h
@@ -1611,7 +1611,7 @@ void ReformToVMSstylePathName(char *Path);
16111611 void ReformVMSDirName(char *DirName, int Flg);
16121612 #endif
16131613 // 自動切断対策
1614-void NoopProc(void);
1614+void NoopProc(int Force);
16151615
16161616 /*===== local.c =====*/
16171617
@@ -1654,7 +1654,9 @@ int DoDirListCmdSkt(char *AddOpt, char *Path, int Num, int *CancelCheckWork);
16541654 #if defined(HAVE_TANDEM)
16551655 void SwitchOSSProc(void);
16561656 #endif
1657-int CommandProcCmd(char *Reply, char *fmt, ...);
1657+// 同時接続対応
1658+//int CommandProcCmd(char *Reply, char *fmt, ...);
1659+int CommandProcCmd(char *Reply, int* CancelCheckWork, char *fmt, ...);
16581660 // 同時接続対応
16591661 //int CommandProcTrn(char *Reply, char *fmt, ...);
16601662 int CommandProcTrn(SOCKET cSkt, char *Reply, int* CancelCheckWork, char *fmt, ...);
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -3731,11 +3731,11 @@ static int RenameUnuseableName(char *Fname)
37313731
37323732 // 自動切断対策
37333733 // NOOPコマンドでは効果が無いホストが多いためLISTコマンドを使用
3734-void NoopProc(void)
3734+void NoopProc(int Force)
37353735 {
37363736 int CancelCheckWork;
37373737 CancelCheckWork = NO;
3738- if(AskConnecting() == YES && AskUserOpeDisabled() == NO)
3738+ if(Force == YES || (AskConnecting() == YES && AskUserOpeDisabled() == NO))
37393739 {
37403740 if(AskReuseCmdSkt() == NO || AskShareProh() == YES || AskTransferNow() == NO)
37413741 {
--- a/getput.c
+++ b/getput.c
@@ -184,6 +184,8 @@ extern int FolderAttr;
184184 extern int FolderAttrNum;
185185 // 同時接続対応
186186 extern int SendQuit;
187+// 自動切断対策
188+extern time_t LastDataConnectionTime;
187189
188190
189191 /*----- ファイル転送スレッドを起動する ----------------------------------------
@@ -2260,6 +2262,8 @@ static int DownloadFile(TRANSPACKET *Pkt, SOCKET dSkt, int CreateMode, int *Canc
22602262 if(shutdown(dSkt, 1) != 0)
22612263 ReportWSError("shutdown", WSAGetLastError());
22622264
2265+ // 自動切断対策
2266+ LastDataConnectionTime = time(NULL);
22632267 DoClose(dSkt);
22642268
22652269 if(ForceAbort == NO)
@@ -3535,6 +3539,8 @@ static int UploadFile(TRANSPACKET *Pkt, SOCKET dSkt)
35353539 Pkt->Abort = ABORT_ERROR;
35363540 }
35373541
3542+ // 自動切断対策
3543+ LastDataConnectionTime = time(NULL);
35383544 if(shutdown(dSkt, 1) != 0)
35393545 ReportWSError("shutdown", WSAGetLastError());
35403546
--- a/hostman.c
+++ b/hostman.c
@@ -1356,7 +1356,7 @@ void CopyDefaultHost(HOSTDATA *Set)
13561356 Set->NetType = NTYPE_AUTO;
13571357 Set->CurNetType = NTYPE_AUTO;
13581358 // 自動切断対策
1359- Set->NoopInterval = 0;
1359+ Set->NoopInterval = 60;
13601360 // 再転送対応
13611361 Set->TransferErrorMode = EXIST_OVW;
13621362 Set->TransferErrorNotify = YES;
--- a/main.c
+++ b/main.c
@@ -35,6 +35,8 @@
3535 #include <stdlib.h>
3636 #include <string.h>
3737 #include <mbstring.h>
38+// 自動切断対策
39+#include <time.h>
3840 #include <malloc.h>
3941 #include <windowsx.h>
4042 #include <commctrl.h>
@@ -248,6 +250,9 @@ int DispFileIcon = NO;
248250 int MakeAllDir = YES;
249251 // UTF-8対応
250252 int LocalKanjiCode = KANJI_SJIS;
253+// 自動切断対策
254+int NoopEnable = NO;
255+time_t LastDataConnectionTime = 0;
251256
252257
253258
@@ -939,9 +944,8 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
939944 SendMessage(GetLocalHwnd(), LVM_ENSUREVISIBLE, (WPARAM)Pos, (LPARAM)TRUE);
940945 }
941946 }
942- break;
943- case 2:
944- NoopProc();
947+ if(NoopEnable == YES && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
948+ NoopProc(NO);
945949 break;
946950 }
947951 break;
@@ -955,20 +959,18 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
955959 {
956960 case MENU_CONNECT :
957961 // 自動切断対策
958- KillTimer(hWnd, 2);
962+ NoopEnable = NO;
959963 ConnectProc(DLG_TYPE_CON, -1);
960964 // 自動切断対策
961- if(AskNoopInterval() > 0)
962- SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);
965+ NoopEnable = YES;
963966 break;
964967
965968 case MENU_CONNECT_NUM :
966969 // 自動切断対策
967- KillTimer(hWnd, 2);
970+ NoopEnable = NO;
968971 ConnectProc(DLG_TYPE_CON, (int)lParam);
969972 // 自動切断対策
970- if(AskNoopInterval() > 0)
971- SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);
973+ NoopEnable = YES;
972974 if(AskConnecting() == YES)
973975 {
974976 if(HIWORD(wParam) & OPT_MIRROR)
@@ -990,20 +992,18 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
990992
991993 case MENU_SET_CONNECT :
992994 // 自動切断対策
993- KillTimer(hWnd, 2);
995+ NoopEnable = NO;
994996 ConnectProc(DLG_TYPE_SET, -1);
995997 // 自動切断対策
996- if(AskNoopInterval() > 0)
997- SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);
998+ NoopEnable = YES;
998999 break;
9991000
10001001 case MENU_QUICK :
10011002 // 自動切断対策
1002- KillTimer(hWnd, 2);
1003+ NoopEnable = NO;
10031004 QuickConnectProc();
10041005 // 自動切断対策
1005- if(AskNoopInterval() > 0)
1006- SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);
1006+ NoopEnable = YES;
10071007 break;
10081008
10091009 case MENU_DISCONNECT :
@@ -1038,11 +1038,10 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
10381038 case MENU_HIST_19 :
10391039 case MENU_HIST_20 :
10401040 // 自動切断対策
1041- KillTimer(hWnd, 2);
1041+ NoopEnable = NO;
10421042 HistoryConnectProc(LOWORD(wParam));
10431043 // 自動切断対策
1044- if(AskNoopInterval() > 0)
1045- SetTimer(hWnd, 2, AskNoopInterval() * 1000, NULL);
1044+ NoopEnable = YES;
10461045 break;
10471046
10481047 case MENU_UPDIR :
--- a/remote.c
+++ b/remote.c
@@ -66,6 +66,8 @@ extern int SendQuit;
6666
6767 // 同時接続対応
6868 extern int CancelFlg;
69+// 自動切断対策
70+extern time_t LastDataConnectionTime;
6971
7072 /*===== ローカルなワーク =====*/
7173
@@ -96,13 +98,19 @@ int DoCWD(char *Path, int Disp, int ForceGet, int ErrorBell)
9698 Sts = FTP_COMPLETE * 100;
9799
98100 if(strcmp(Path, "..") == 0)
99- Sts = CommandProcCmd(NULL, "CDUP");
101+ // 同時接続対応
102+// Sts = CommandProcCmd(NULL, "CDUP");
103+ Sts = CommandProcCmd(NULL, &CancelFlg, "CDUP");
100104 else if(strcmp(Path, "") != 0)
101105 {
102106 if((AskHostType() != HTYPE_VMS) || (strchr(Path, '[') != NULL))
103- Sts = CommandProcCmd(NULL, "CWD %s", Path);
107+ // 同時接続対応
108+// Sts = CommandProcCmd(NULL, "CWD %s", Path);
109+ Sts = CommandProcCmd(NULL, &CancelFlg, "CWD %s", Path);
104110 else
105- Sts = CommandProcCmd(NULL, "CWD [.%s]", Path); /* VMS用 */
111+ // 同時接続対応
112+// Sts = CommandProcCmd(NULL, "CWD [.%s]", Path); /* VMS用 */
113+ Sts = CommandProcCmd(NULL, &CancelFlg, "CWD [.%s]", Path); /* VMS用 */
106114 }
107115
108116 if((Sts/100 >= FTP_CONTINUE) && (ErrorBell == YES))
@@ -220,12 +228,16 @@ static int DoPWD(char *Buf)
220228
221229 if(PwdCommandType == PWD_XPWD)
222230 {
223- Sts = CommandProcCmd(Tmp, "XPWD");
231+ // 同時接続対応
232+// Sts = CommandProcCmd(Tmp, "XPWD");
233+ Sts = CommandProcCmd(Tmp, &CancelFlg, "XPWD");
224234 if(Sts/100 != FTP_COMPLETE)
225235 PwdCommandType = PWD_PWD;
226236 }
227237 if(PwdCommandType == PWD_PWD)
228- Sts = CommandProcCmd(Tmp, "PWD");
238+ // 同時接続対応
239+// Sts = CommandProcCmd(Tmp, "PWD");
240+ Sts = CommandProcCmd(Tmp, &CancelFlg, "PWD");
229241
230242 if(Sts/100 == FTP_COMPLETE)
231243 {
@@ -279,11 +291,17 @@ int DoMKD(char *Path)
279291 {
280292 int Sts;
281293
282- Sts = CommandProcCmd(NULL, "MKD %s", Path);
294+ // 同時接続対応
295+// Sts = CommandProcCmd(NULL, "MKD %s", Path);
296+ Sts = CommandProcCmd(NULL, &CancelFlg, "MKD %s", Path);
283297
284298 if(Sts/100 >= FTP_CONTINUE)
285299 SoundPlay(SND_ERROR);
286300
301+ // 自動切断対策
302+ if(CancelFlg == NO && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
303+ NoopProc(YES);
304+
287305 return(Sts/100);
288306 }
289307
@@ -301,11 +319,17 @@ int DoRMD(char *Path)
301319 {
302320 int Sts;
303321
304- Sts = CommandProcCmd(NULL, "RMD %s", Path);
322+ // 同時接続対応
323+// Sts = CommandProcCmd(NULL, "RMD %s", Path);
324+ Sts = CommandProcCmd(NULL, &CancelFlg, "RMD %s", Path);
305325
306326 if(Sts/100 >= FTP_CONTINUE)
307327 SoundPlay(SND_ERROR);
308328
329+ // 自動切断対策
330+ if(CancelFlg == NO && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
331+ NoopProc(YES);
332+
309333 return(Sts/100);
310334 }
311335
@@ -323,11 +347,17 @@ int DoDELE(char *Path)
323347 {
324348 int Sts;
325349
326- Sts = CommandProcCmd(NULL, "DELE %s", Path);
350+ // 同時接続対応
351+// Sts = CommandProcCmd(NULL, "DELE %s", Path);
352+ Sts = CommandProcCmd(NULL, &CancelFlg, "DELE %s", Path);
327353
328354 if(Sts/100 >= FTP_CONTINUE)
329355 SoundPlay(SND_ERROR);
330356
357+ // 自動切断対策
358+ if(CancelFlg == NO && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
359+ NoopProc(YES);
360+
331361 return(Sts/100);
332362 }
333363
@@ -346,7 +376,9 @@ int DoRENAME(char *Src, char *Dst)
346376 {
347377 int Sts;
348378
349- Sts = CommandProcCmd(NULL, "RNFR %s", Src);
379+ // 同時接続対応
380+// Sts = CommandProcCmd(NULL, "RNFR %s", Src);
381+ Sts = CommandProcCmd(NULL, &CancelFlg, "RNFR %s", Src);
350382 if(Sts == 350)
351383 // 同時接続対応
352384 // Sts = command(AskCmdCtrlSkt(), NULL, &CheckCancelFlg, "RNTO %s", Dst);
@@ -355,6 +387,10 @@ int DoRENAME(char *Src, char *Dst)
355387 if(Sts/100 >= FTP_CONTINUE)
356388 SoundPlay(SND_ERROR);
357389
390+ // 自動切断対策
391+ if(CancelFlg == NO && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
392+ NoopProc(YES);
393+
358394 return(Sts/100);
359395 }
360396
@@ -373,11 +409,17 @@ int DoCHMOD(char *Path, char *Mode)
373409 {
374410 int Sts;
375411
376- Sts = CommandProcCmd(NULL, "%s %s %s", AskHostChmodCmd(), Mode, Path);
412+ // 同時接続対応
413+// Sts = CommandProcCmd(NULL, "%s %s %s", AskHostChmodCmd(), Mode, Path);
414+ Sts = CommandProcCmd(NULL, &CancelFlg, "%s %s %s", AskHostChmodCmd(), Mode, Path);
377415
378416 if(Sts/100 >= FTP_CONTINUE)
379417 SoundPlay(SND_ERROR);
380418
419+ // 自動切断対策
420+ if(CancelFlg == NO && AskNoopInterval() > 0 && time(NULL) - LastDataConnectionTime >= AskNoopInterval())
421+ NoopProc(YES);
422+
381423 return(Sts/100);
382424 }
383425
@@ -681,7 +723,9 @@ static int DoDirList(HWND hWnd, SOCKET cSkt, char *AddOpt, char *Path, int Num,
681723 * コマンドコントロールソケットを使う
682724 *----------------------------------------------------------------------------*/
683725
684-int CommandProcCmd(char *Reply, char *fmt, ...)
726+// 同時接続対応
727+//int CommandProcCmd(char *Reply, char *fmt, ...)
728+int CommandProcCmd(char *Reply, int* CancelCheckWork, char *fmt, ...)
685729 {
686730 va_list Args;
687731 char Cmd[1024];
@@ -703,7 +747,7 @@ int CommandProcCmd(char *Reply, char *fmt, ...)
703747 // {
704748 // 同時接続対応
705749 // Sts = command(AskCmdCtrlSkt(), Reply, &CheckCancelFlg, "%s", Cmd);
706- Sts = command(AskCmdCtrlSkt(), Reply, &CancelFlg, "%s", Cmd);
750+ Sts = command(AskCmdCtrlSkt(), Reply, CancelCheckWork, "%s", Cmd);
707751 // }
708752 // }
709753 return(Sts);