• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Loweynet


コミットメタ情報

リビジョンdce74878dd044e66c99341f617cb1b9de781acad (tree)
日時2011-09-19 15:01:12
作者s_kawamoto <s_kawamoto@user...>
コミッターs_kawamoto

ログメッセージ

Fix bugs of deadlock around simultaneous connection.
Fix bugs of deadlock around getting host names.

変更サマリ

差分

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/connect.c
+++ b/connect.c
@@ -964,21 +964,21 @@ int ReConnectTrnSkt(SOCKET *Skt)
964964
965965 SetTaskMsg(MSGJPN003);
966966
967- DisableUserOpe();
967+// DisableUserOpe();
968968 /* 現在のソケットは切断 */
969969 if(*Skt != INVALID_SOCKET)
970970 do_closesocket(*Skt);
971971 /* 再接続 */
972972 if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET)
973973 {
974- AskRemoteCurDir(Path, FMAX_PATH);
974+// AskRemoteCurDir(Path, FMAX_PATH);
975975 // DoCWD(Path, YES, YES, YES);
976976 Sts = FFFTP_SUCCESS;
977977 }
978978 else
979979 SoundPlay(SND_ERROR);
980980
981- EnableUserOpe();
981+// EnableUserOpe();
982982 return(Sts);
983983 }
984984
--- a/getput.c
+++ b/getput.c
@@ -356,7 +356,13 @@ void AddTransFileList(TRANSPACKET *Pkt)
356356 {
357357 DispTransPacket(Pkt);
358358
359- WaitForSingleObject(hListAccMutex, INFINITE);
359+ // 同時接続対応
360+// WaitForSingleObject(hListAccMutex, INFINITE);
361+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
362+ {
363+ BackgrndMessageProc();
364+ Sleep(1);
365+ }
360366
361367 if(AddTmpTransFileList(Pkt, &TransPacketBase) == FFFTP_SUCCESS)
362368 {
@@ -390,7 +396,13 @@ void AppendTransFileList(TRANSPACKET *Pkt)
390396 {
391397 TRANSPACKET *Pos;
392398
393- WaitForSingleObject(hListAccMutex, INFINITE);
399+ // 同時接続対応
400+// WaitForSingleObject(hListAccMutex, INFINITE);
401+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
402+ {
403+ BackgrndMessageProc();
404+ Sleep(1);
405+ }
394406
395407 if(TransPacketBase == NULL)
396408 TransPacketBase = Pkt;
@@ -468,7 +480,13 @@ static void EraseTransFileList(void)
468480
469481 NotDel = NULL;
470482
471- WaitForSingleObject(hListAccMutex, INFINITE);
483+ // 同時接続対応
484+// WaitForSingleObject(hListAccMutex, INFINITE);
485+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
486+ {
487+ BackgrndMessageProc();
488+ Sleep(1);
489+ }
472490 New = TransPacketBase;
473491 while(New != NULL)
474492 {
@@ -621,7 +639,12 @@ static ULONG WINAPI TransferThread(void *Dummy)
621639 if(fTransferThreadExit == TRUE)
622640 break;
623641
624- WaitForSingleObject(hListAccMutex, INFINITE);
642+// WaitForSingleObject(hListAccMutex, INFINITE);
643+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
644+ {
645+ BackgrndMessageProc();
646+ Sleep(1);
647+ }
625648 memset(ErrMsg, NUL, ERR_MSG_LEN+7);
626649
627650 // Canceled = NO;
@@ -634,7 +657,12 @@ static ULONG WINAPI TransferThread(void *Dummy)
634657 {
635658 ReleaseMutex(hListAccMutex);
636659 ReConnectTrnSkt(&TrnSkt);
637- WaitForSingleObject(hListAccMutex, INFINITE);
660+// WaitForSingleObject(hListAccMutex, INFINITE);
661+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
662+ {
663+ BackgrndMessageProc();
664+ Sleep(1);
665+ }
638666 }
639667 }
640668 else
@@ -644,7 +672,12 @@ static ULONG WINAPI TransferThread(void *Dummy)
644672 ReleaseMutex(hListAccMutex);
645673 DoClose(TrnSkt);
646674 TrnSkt = INVALID_SOCKET;
647- WaitForSingleObject(hListAccMutex, INFINITE);
675+// WaitForSingleObject(hListAccMutex, INFINITE);
676+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
677+ {
678+ BackgrndMessageProc();
679+ Sleep(1);
680+ }
648681 }
649682 }
650683 CmdSkt = NewCmdSkt;
@@ -958,7 +991,12 @@ static ULONG WINAPI TransferThread(void *Dummy)
958991
959992 if(ForceAbort == NO)
960993 {
961- WaitForSingleObject(hListAccMutex, INFINITE);
994+// WaitForSingleObject(hListAccMutex, INFINITE);
995+ while(WaitForSingleObject(hListAccMutex, 0) == WAIT_TIMEOUT)
996+ {
997+ BackgrndMessageProc();
998+ Sleep(1);
999+ }
9621000 if(ClearAll == YES)
9631001 // EraseTransFileList();
9641002 {
--- a/main.c
+++ b/main.c
@@ -2615,7 +2615,6 @@ int BackgrndMessageProc(void)
26152615 int Ret;
26162616
26172617 Ret = NO;
2618- SendMessage(GetMainHwnd(), WM_NULL, 0, 0);
26192618 while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
26202619 {
26212620 if(!HtmlHelp(NULL, NULL, HH_PRETRANSLATEMESSAGE, (DWORD)&Msg))
--- a/mbswrapper.c
+++ b/mbswrapper.c
@@ -549,7 +549,7 @@ START_ROUTINE
549549 r = TerminateStringM((LPSTR)lParam, wParam);
550550 break;
551551 case WM_GETTEXTLENGTH:
552- Size = SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
552+ Size = SendMessageW(hWnd, WM_GETTEXTLENGTH, wParam, lParam) + 1;
553553 pw0 = AllocateStringW(Size);
554554 SendMessageW(hWnd, WM_GETTEXT, (WPARAM)Size, (LPARAM)pw0);
555555 r = WtoM(NULL, 0, pw0, -1) - 1;
--- a/socket.c
+++ b/socket.c
@@ -291,6 +291,31 @@ static LRESULT CALLBACK SocketWndProc(HWND hWnd, UINT message, WPARAM wParam, LP
291291 break;
292292 }
293293 }
294+ // APIの仕様上ハンドルが登録される前にウィンドウメッセージが呼び出される可能性あり
295+ if(Pos == MAX_SIGNAL_ENTRY_DBASE)
296+ {
297+ for(Pos = 0; Pos < MAX_SIGNAL_ENTRY_DBASE; Pos++)
298+ {
299+ if(SignalDbase[Pos].Async == 0)
300+ {
301+ SignalDbase[Pos].Async = (HANDLE)wParam;
302+ SignalDbase[Pos].Done = 0;
303+ SignalDbase[Pos].ErrorDb = 0;
304+ if(HIWORD(lParam) != 0)
305+ {
306+ SignalDbase[Pos].ErrorDb = 1;
307+#if DBG_MSG
308+ DoPrintf("##### SignalDatabase: error");
309+#endif
310+ }
311+ SignalDbase[Pos].Done = 1;
312+#if DBG_MSG
313+ DoPrintf("##### SignalDatabase: Done");
314+#endif
315+ break;
316+ }
317+ }
318+ }
294319 // スレッド衝突のバグ修正
295320 ReleaseMutex(hAsyncTblAccMutex);
296321 break;
@@ -525,7 +550,7 @@ static int RegistAsyncTableDbase(HANDLE Async)
525550 {
526551 // 強制的に閉じられたハンドルがあると重複する可能性あり
527552 // MessageBox(GetMainHwnd(), "Async handle already registerd.", "FFFTP inner error", MB_OK);
528- SignalDbase[Pos].Async = 0;
553+ // APIの仕様上ハンドルが登録される前にウィンドウメッセージが呼び出される可能性あり
529554 break;
530555 }
531556 }