• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

FFFTPのソースコードです。


Commit MetaInfo

修订版66613203e90b0402574ce35f6cf160adc5057db1 (tree)
时间2012-04-21 20:03:18
作者s_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Change intervals between keep alive packets.

更改概述

差异

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
@@ -38,6 +38,8 @@
3838 // IPv6対応
3939 //#include <winsock.h>
4040 #include <winsock2.h>
41+// 切断対策
42+#include <mstcpip.h>
4143 #include <windowsx.h>
4244 #include <commctrl.h>
4345
@@ -102,6 +104,8 @@ extern int FwallLower;
102104 extern int FwallDelimiter;
103105 extern int PasvDefault;
104106 extern int QuickAnonymous;
107+// 切断対策
108+extern int TimeOut;
105109
106110 /*===== ローカルなワーク =====*/
107111
@@ -1437,6 +1441,8 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
14371441 static const char *SiteTbl[4] = { "SITE", "site", "OPEN", "open" };
14381442 char TmpBuf[ONELINE_BUF_SIZE];
14391443 struct linger LingerOpt;
1444+ struct tcp_keepalive KeepAlive;
1445+ DWORD dwTmp;
14401446
14411447 // 暗号化通信対応
14421448 ContSock = INVALID_SOCKET;
@@ -1510,6 +1516,12 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
15101516 Flg = 1;
15111517 if(setsockopt(ContSock, SOL_SOCKET, SO_KEEPALIVE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR)
15121518 ReportWSError("setsockopt", WSAGetLastError());
1519+ // 切断対策
1520+ KeepAlive.onoff = 1;
1521+ KeepAlive.keepalivetime = TimeOut * 1000;
1522+ KeepAlive.keepaliveinterval = 1000;
1523+ if(WSAIoctl(ContSock, SIO_KEEPALIVE_VALS, &KeepAlive, sizeof(struct tcp_keepalive), NULL, 0, &dwTmp, NULL, NULL) == SOCKET_ERROR)
1524+ ReportWSError("WSAIoctl", WSAGetLastError());
15131525 LingerOpt.l_onoff = 1;
15141526 LingerOpt.l_linger = 90;
15151527 if(setsockopt(ContSock, SOL_SOCKET, SO_LINGER, (LPSTR)&LingerOpt, sizeof(LingerOpt)) == SOCKET_ERROR)