OSDN Git Service

Change intervals between keep alive packets.
authors_kawamoto <s_kawamoto@users.sourceforge.jp>
Fri, 1 Jun 2012 08:46:52 +0000 (17:46 +0900)
committers_kawamoto <s_kawamoto@users.sourceforge.jp>
Fri, 1 Jun 2012 08:46:52 +0000 (17:46 +0900)
FFFTP_Eng_Release/FFFTP.exe
Release/FFFTP.exe
connect.c

index 861c65e..c154e8d 100644 (file)
Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
index a51f2a9..7ce1e38 100644 (file)
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
index 98f7121..fcb447d 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -1517,11 +1517,14 @@ static SOCKET DoConnectCrypt(int CryptMode, HOSTDATA* HostData, char *Host, char
                                        if(setsockopt(ContSock, SOL_SOCKET, SO_KEEPALIVE, (LPSTR)&Flg, sizeof(Flg)) == SOCKET_ERROR)\r
                                                ReportWSError("setsockopt", WSAGetLastError());\r
                                        // 切断対策\r
-                                       KeepAlive.onoff = 1;\r
-                                       KeepAlive.keepalivetime = TimeOut * 1000;\r
-                                       KeepAlive.keepaliveinterval = 1000;\r
-                                       if(WSAIoctl(ContSock, SIO_KEEPALIVE_VALS, &KeepAlive, sizeof(struct tcp_keepalive), NULL, 0, &dwTmp, NULL, NULL) == SOCKET_ERROR)\r
-                                               ReportWSError("WSAIoctl", WSAGetLastError());\r
+                                       if(TimeOut > 0)\r
+                                       {\r
+                                               KeepAlive.onoff = 1;\r
+                                               KeepAlive.keepalivetime = TimeOut * 1000;\r
+                                               KeepAlive.keepaliveinterval = 1000;\r
+                                               if(WSAIoctl(ContSock, SIO_KEEPALIVE_VALS, &KeepAlive, sizeof(struct tcp_keepalive), NULL, 0, &dwTmp, NULL, NULL) == SOCKET_ERROR)\r
+                                                       ReportWSError("WSAIoctl", WSAGetLastError());\r
+                                       }\r
                                        LingerOpt.l_onoff = 1;\r
                                        LingerOpt.l_linger = 90;\r
                                        if(setsockopt(ContSock, SOL_SOCKET, SO_LINGER, (LPSTR)&LingerOpt, sizeof(LingerOpt)) == SOCKET_ERROR)\r