• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

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

Loweynet


Commit MetaInfo

Revisãoc3c5ce768282208e5678f485c889484f9343cb48 (tree)
Hora2012-02-07 00:36:12
Autors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Mensagem de Log

Fix bugs of simultaneous connection.
Fix bugs of exclusive locks for UI.

Mudança Sumário

Diff

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/filelist.c
+++ b/filelist.c
@@ -786,6 +786,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
786786 return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam));
787787
788788 case WM_DROPFILES :
789+ // 同時接続対応
790+ if(AskUserOpeDisabled() == YES)
791+ break;
789792 // ドラッグ中は処理しない。ドラッグ後にWM_LBUTTONDOWNが飛んでくるため、そこで処理する。
790793 if (Dragging == YES)
791794 return (FALSE);
@@ -818,6 +821,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA
818821 hCsrDrg = LoadCursor(NULL, IDC_ARROW);
819822 SetCursor(hCsrDrg);
820823
824+ // 同時接続対応
825+ if(AskUserOpeDisabled() == YES)
826+ break;
821827 Point.x = (long)(short)LOWORD(lParam);
822828 Point.y = (long)(short)HIWORD(lParam);
823829 ClientToScreen(hWnd, &Point);
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -261,8 +261,9 @@ void DownLoadProc(int ChName, int ForceFile, int All)
261261 }
262262 DeleteFileList(&FileListBase);
263263
264- strcpy(Pkt.Cmd, "GOQUIT");
265- AddTransFileList(&Pkt);
264+ // 同時接続対応
265+// strcpy(Pkt.Cmd, "GOQUIT");
266+// AddTransFileList(&Pkt);
266267
267268 GoForwardTransWindow();
268269 // KeepTransferDialog(NO);
@@ -363,8 +364,9 @@ void DirectDownLoadProc(char *Fname)
363364 AddTransFileList(&Pkt);
364365 }
365366
366- strcpy(Pkt.Cmd, "GOQUIT");
367- AddTransFileList(&Pkt);
367+ // 同時接続対応
368+// strcpy(Pkt.Cmd, "GOQUIT");
369+// AddTransFileList(&Pkt);
368370
369371 GoForwardTransWindow();
370372 // KeepTransferDialog(NO);
@@ -629,8 +631,9 @@ void MirrorDownloadProc(int Notify)
629631 AddTransFileList(&Pkt);
630632 }
631633
632- strcpy(Pkt.Cmd, "GOQUIT");
633- AddTransFileList(&Pkt);
634+ // 同時接続対応
635+// strcpy(Pkt.Cmd, "GOQUIT");
636+// AddTransFileList(&Pkt);
634637 }
635638 else
636639 EraseTmpTransFileList(&Base);
@@ -1056,8 +1059,9 @@ void UpLoadListProc(int ChName, int All)
10561059
10571060 DeleteFileList(&FileListBase);
10581061
1059- strcpy(Pkt.Cmd, "GOQUIT");
1060- AddTransFileList(&Pkt);
1062+ // 同時接続対応
1063+// strcpy(Pkt.Cmd, "GOQUIT");
1064+// AddTransFileList(&Pkt);
10611065
10621066 GoForwardTransWindow();
10631067
@@ -1223,8 +1227,9 @@ void UpLoadDragProc(WPARAM wParam)
12231227
12241228 DeleteFileList(&FileListBase);
12251229
1226- strcpy(Pkt.Cmd, "GOQUIT");
1227- AddTransFileList(&Pkt);
1230+ // 同時接続対応
1231+// strcpy(Pkt.Cmd, "GOQUIT");
1232+// AddTransFileList(&Pkt);
12281233
12291234 GoForwardTransWindow();
12301235
@@ -1494,8 +1499,9 @@ void MirrorUploadProc(int Notify)
14941499 AddTransFileList(&Pkt);
14951500 }
14961501
1497- strcpy(Pkt.Cmd, "GOQUIT");
1498- AddTransFileList(&Pkt);
1502+ // 同時接続対応
1503+// strcpy(Pkt.Cmd, "GOQUIT");
1504+// AddTransFileList(&Pkt);
14991505 }
15001506 else
15011507 EraseTmpTransFileList(&Base);
--- a/getput.c
+++ b/getput.c
@@ -537,7 +537,7 @@ static void EraseTransFileList(void)
537537 TRANSPACKET *New;
538538 TRANSPACKET *Next;
539539 TRANSPACKET *NotDel;
540- TRANSPACKET Pkt;
540+// TRANSPACKET Pkt;
541541
542542 NotDel = NULL;
543543
@@ -582,8 +582,9 @@ static void EraseTransFileList(void)
582582 // 同時接続対応
583583 WaitForMainThread = NO;
584584
585- strcpy(Pkt.Cmd, "GOQUIT");
586- AddTransFileList(&Pkt);
585+ // 同時接続対応
586+// strcpy(Pkt.Cmd, "GOQUIT");
587+// AddTransFileList(&Pkt);
587588 return;
588589 }
589590
@@ -742,6 +743,8 @@ static ULONG WINAPI TransferThread(void *Dummy)
742743 Pos = TransPacketBase;
743744 TransPacketBase = TransPacketBase->Next;
744745 free(Pos);
746+ if(TransPacketBase == NULL)
747+ GoExit = YES;
745748 }
746749 NewCmdSkt = AskCmdCtrlSkt();
747750 if(AskReuseCmdSkt() == YES && ThreadCount == 0)
@@ -759,9 +762,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
759762 else
760763 CheckClosedAndReconnectTrnSkt(&TrnSkt, &Canceled[ThreadCount]);
761764 // 同時ログイン数制限対策
762- if(TrnSkt != INVALID_SOCKET)
763- LastUsed = timeGetTime();
764- else
765+ if(TrnSkt == INVALID_SOCKET)
765766 {
766767 // 同時ログイン数制限に引っかかった可能性あり
767768 // 負荷を下げるために約10秒間待機
@@ -773,6 +774,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
773774 i--;
774775 }
775776 }
777+ LastUsed = timeGetTime();
776778 // WaitForSingleObject(hListAccMutex, INFINITE);
777779 while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
778780 {
@@ -786,7 +788,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
786788 {
787789 // 同時ログイン数制限対策
788790 // 60秒間使用されなければログアウト
789- if(timeGetTime() - LastUsed > 60000)
791+ if(timeGetTime() - LastUsed > 60000 || NewCmdSkt == INVALID_SOCKET)
790792 {
791793 ReleaseMutex(hListAccMutex);
792794 SendData(TrnSkt, "QUIT\r\n", 6, 0, &Canceled[ThreadCount]);
@@ -806,13 +808,6 @@ static ULONG WINAPI TransferThread(void *Dummy)
806808 // if(TransPacketBase != NULL)
807809 if(TrnSkt != INVALID_SOCKET && NextTransPacketBase != NULL)
808810 {
809- if(strcmp(NextTransPacketBase->Cmd, "GOQUIT") == 0 && NextTransPacketBase != TransPacketBase)
810- {
811- ReleaseMutex(hListAccMutex);
812- BackgrndMessageProc();
813- Sleep(1);
814- continue;
815- }
816811 Pos = NextTransPacketBase;
817812 NextTransPacketBase = NextTransPacketBase->Next;
818813 // ディレクトリ操作は非同期で行わない
@@ -841,6 +836,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
841836 // TransPacketBase->hWndTrans = hWndTrans;
842837 Pos->hWndTrans = hWndTrans;
843838 Pos->ctrl_skt = TrnSkt;
839+ Pos->Abort = ABORT_NONE;
844840 Pos->ThreadCount = ThreadCount;
845841
846842 if(hWndTrans != NULL)
@@ -856,6 +852,9 @@ static ULONG WINAPI TransferThread(void *Dummy)
856852 // SendMessage(hWndTrans, WM_SET_PACKET, 0, (LPARAM)TransPacketBase);
857853 SendMessage(hWndTrans, WM_SET_PACKET, 0, (LPARAM)Pos);
858854
855+ // 中断後に受信バッファに応答が残っていると次のコマンドの応答が正しく処理できない
856+ RemoveReceivedData(TrnSkt);
857+
859858 /* ダウンロード */
860859 // if(strncmp(TransPacketBase->Cmd, "RETR", 4) == 0)
861860 if(strncmp(Pos->Cmd, "RETR", 4) == 0)
@@ -1110,11 +1109,11 @@ static ULONG WINAPI TransferThread(void *Dummy)
11101109 }
11111110 /* 自動終了のための通知 */
11121111 // else if(strcmp(TransPacketBase->Cmd, "GOQUIT") == 0)
1113- else if(strcmp(Pos->Cmd, "GOQUIT") == 0)
1114- {
1115- ReleaseMutex(hListAccMutex);
1116- GoExit = YES;
1117- }
1112+// else if(strcmp(Pos->Cmd, "GOQUIT") == 0)
1113+// {
1114+// ReleaseMutex(hListAccMutex);
1115+// GoExit = YES;
1116+// }
11181117 else
11191118 ReleaseMutex(hListAccMutex);
11201119
@@ -1134,6 +1133,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
11341133 for(i = 0; i < MAX_DATA_CONNECTION; i++)
11351134 Canceled[i] = YES;
11361135 EraseTransFileList();
1136+ GoExit = YES;
11371137 Pos = NULL;
11381138 }
11391139 else
@@ -1152,7 +1152,7 @@ static ULONG WINAPI TransferThread(void *Dummy)
11521152 // TransPacketBase = TransPacketBase->Next;
11531153 // free(Pos);
11541154 }
1155- ClearAll = NO;
1155+// ClearAll = NO;
11561156 ReleaseMutex(hListAccMutex);
11571157
11581158 if(BackgrndMessageProc() == YES)
@@ -1171,8 +1171,25 @@ static ULONG WINAPI TransferThread(void *Dummy)
11711171 // else
11721172 else if(TransPacketBase == NULL)
11731173 {
1174+ ClearAll = NO;
11741175 DelNotify = NO;
11751176
1177+ if(GoExit == YES)
1178+ {
1179+ SoundPlay(SND_TRANS);
1180+ if(AskAutoExit() == NO)
1181+ {
1182+ if(Down == YES)
1183+ PostMessage(GetMainHwnd(), WM_REFRESH_LOCAL_FLG, 0, 0);
1184+ if(Up == YES)
1185+ PostMessage(GetMainHwnd(), WM_REFRESH_REMOTE_FLG, 0, 0);
1186+ }
1187+ Down = NO;
1188+ Up = NO;
1189+ PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_AUTO_EXIT, 0), 0);
1190+ GoExit = NO;
1191+ }
1192+
11761193 ReleaseMutex(hListAccMutex);
11771194 if(KeepDlg == NO)
11781195 {
@@ -1201,22 +1218,6 @@ static ULONG WINAPI TransferThread(void *Dummy)
12011218 // Sleep(1);
12021219 Sleep(100);
12031220
1204- if(GoExit == YES)
1205- {
1206- SoundPlay(SND_TRANS);
1207- if(AskAutoExit() == NO)
1208- {
1209- if(Down == YES)
1210- PostMessage(GetMainHwnd(), WM_REFRESH_LOCAL_FLG, 0, 0);
1211- if(Up == YES)
1212- PostMessage(GetMainHwnd(), WM_REFRESH_REMOTE_FLG, 0, 0);
1213- }
1214- Down = NO;
1215- Up = NO;
1216- PostMessage(GetMainHwnd(), WM_COMMAND, MAKEWPARAM(MENU_AUTO_EXIT, 0), 0);
1217- GoExit = NO;
1218- }
1219-
12201221 // 再転送対応
12211222 TransferErrorMode = AskTransferErrorMode();
12221223 TransferErrorNotify = AskTransferErrorNotify();
@@ -1346,6 +1347,8 @@ int DoDownLoad(SOCKET cSkt, TRANSPACKET *Pkt, int DirList, int *CancelCheckWork)
13461347 }
13471348 else
13481349 SetErrorMsg(Reply);
1350+ // エラーによってはダイアログが表示されない場合があるバグ対策
1351+ DispDownloadFinishMsg(Pkt, iRetCode);
13491352 }
13501353 else
13511354 {
@@ -1353,8 +1356,6 @@ int DoDownLoad(SOCKET cSkt, TRANSPACKET *Pkt, int DirList, int *CancelCheckWork)
13531356 SetTaskMsg(MSGJPN089, Pkt->RemoteFile);
13541357 iRetCode = 200;
13551358 }
1356- // エラーによってはダイアログが表示されない場合があるバグ対策
1357- DispDownloadFinishMsg(Pkt, iRetCode);
13581359 return(iRetCode);
13591360 }
13601361
@@ -2281,6 +2282,8 @@ static void DispDownloadFinishMsg(TRANSPACKET *Pkt, int iRetCode)
22812282 {
22822283 char Fname[FMAX_PATH+1];
22832284
2285+ // 同時接続対応
2286+ ReleaseMutex(hListAccMutex);
22842287 if(ForceAbort == NO)
22852288 {
22862289 if((iRetCode/100) >= FTP_CONTINUE)
@@ -2300,7 +2303,9 @@ static void DispDownloadFinishMsg(TRANSPACKET *Pkt, int iRetCode)
23002303 return;
23012304 #endif
23022305
2303- if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0))
2306+ // MLSD対応
2307+// if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0))
2308+ if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0) || (strncmp(Pkt->Cmd, "MLSD", 4) == 0))
23042309 {
23052310 SetTaskMsg(MSGJPN097);
23062311 strcpy(Fname, MSGJPN098);
@@ -2337,7 +2342,9 @@ static void DispDownloadFinishMsg(TRANSPACKET *Pkt, int iRetCode)
23372342 }
23382343 else
23392344 {
2340- if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0))
2345+ // MLSD対応
2346+// if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0))
2347+ if((strncmp(Pkt->Cmd, "NLST", 4) == 0) || (strncmp(Pkt->Cmd, "LIST", 4) == 0) || (strncmp(Pkt->Cmd, "MLSD", 4) == 0))
23412348 SetTaskMsg(MSGJPN101, Pkt->ExistSize);
23422349 // 同時接続対応
23432350 // else if((Pkt->hWndTrans != NULL) && (TimeStart != 0))
@@ -2610,6 +2617,8 @@ static int DoUpLoad(SOCKET cSkt, TRANSPACKET *Pkt)
26102617 // エラーによってはダイアログが表示されない場合があるバグ対策
26112618 // DispUploadFinishMsg(Pkt, iRetCode);
26122619 }
2620+ // エラーによってはダイアログが表示されない場合があるバグ対策
2621+ DispUploadFinishMsg(Pkt, iRetCode);
26132622 }
26142623 else
26152624 {
@@ -2617,8 +2626,6 @@ static int DoUpLoad(SOCKET cSkt, TRANSPACKET *Pkt)
26172626 SetTaskMsg(MSGJPN107, Pkt->LocalFile);
26182627 iRetCode = 200;
26192628 }
2620- // エラーによってはダイアログが表示されない場合があるバグ対策
2621- DispUploadFinishMsg(Pkt, iRetCode);
26222629 return(iRetCode);
26232630 }
26242631
@@ -3579,6 +3586,8 @@ static int TermCodeConvAndSend(TERMCODECONVINFO *tInfo, SOCKET Skt, char *Data,
35793586
35803587 static void DispUploadFinishMsg(TRANSPACKET *Pkt, int iRetCode)
35813588 {
3589+ // 同時接続対応
3590+ ReleaseMutex(hListAccMutex);
35823591 if(ForceAbort == NO)
35833592 {
35843593 if((iRetCode/100) >= FTP_CONTINUE)
@@ -3738,8 +3747,6 @@ static LRESULT CALLBACK TransDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM
37383747 // if(!(Pkt = (TRANSPACKET*)GetWindowLong(hDlg, GWL_USERDATA)))
37393748 if(!(Pkt = (TRANSPACKET*)GetWindowLongPtr(hDlg, GWLP_USERDATA)))
37403749 break;
3741- if(Canceled[Pkt->ThreadCount] == YES)
3742- Pkt->Abort = ABORT_USER;
37433750 DispTransferStatus(hDlg, NO, Pkt);
37443751 SetTimer(hDlg, TIMER_DISPLAY, DISPLAY_TIMING, NULL);
37453752 }