浏览代码

FIX: Ftp plugin hangs on connect

Alexander Koblov 10 年之前
父节点
当前提交
5349653d37
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      plugins/wfx/ftp/src/ftpadv.pas

+ 8 - 1
plugins/wfx/ftp/src/ftpadv.pas

@@ -189,6 +189,7 @@ end;
 constructor TFTPSendEx.Create;
 constructor TFTPSendEx.Create;
 begin
 begin
   inherited Create;
   inherited Create;
+  FTimeout:= 30000;
   FDirectFile:= True;
   FDirectFile:= True;
   ClientToServer:= @Dummy;
   ClientToServer:= @Dummy;
   ServerToClient:= @Dummy;
   ServerToClient:= @Dummy;
@@ -219,9 +220,15 @@ begin
 end;
 end;
 
 
 function TFTPSendEx.List(Directory: String; NameList: Boolean): Boolean;
 function TFTPSendEx.List(Directory: String; NameList: Boolean): Boolean;
+var
+  Message: String;
 begin
 begin
   Result:= inherited List(Directory, NameList);
   Result:= inherited List(Directory, NameList);
-  if FDSock.LastError <> 0 then ReadResult;
+  if (Result = False) and (FSock.WaitingData > 0) then
+  begin
+    Message:= FSock.RecvPacket(1000);
+    LogProc(PluginNumber, msgtype_importanterror, PAnsiChar(Message));
+  end;
 end;
 end;
 
 
 function TFTPSendEx.SetTime(const FileName: String; FileTime: TDateTime): Boolean;
 function TFTPSendEx.SetTime(const FileName: String; FileTime: TDateTime): Boolean;