[Title] Fixed a bug that file transfer failed
authordonghee yang <donghee.yang@samsung.com>
Mon, 27 Aug 2012 07:29:17 +0000 (16:29 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Mon, 27 Aug 2012 07:29:17 +0000 (16:29 +0900)
src/build_server/BuildComm.rb

index f4025fdc15daa7f12fc0606c1797ca87e43ccb6a..5b0b0d47597b281d225dc8ca5e3ffbc10f518779 100644 (file)
@@ -155,7 +155,7 @@ class BuildCommServer
 
                                        # upload to ftp server
                                        ftp_filepath = nil                                      
-                                       ATTEMPTS.each do |attempt|
+                                       for attempt in ATTEMPTS
                            ftp_filepath = FileTransfer.putfile(ip, port, username, passwd, src_file, @log)
                                                if !ftp_filepath.nil? then break;
                                                else @log.info "Server is the #{attempt} upload attempt fails" end
@@ -163,7 +163,9 @@ class BuildCommServer
                                        if ftp_filepath.nil? then
                                                req.puts "ERROR"                                                        
                                                return false 
-                                       else @log.info "Server is the #{attempt} successful attempt to upload file: [#{File.basename(src_file)}]" end
+                                       else 
+                                               @log.info "Server is the #{attempt} successful attempt to upload file: [#{File.basename(src_file)}]" 
+                                       end
                     req.puts "UPLOADED,#{ftp_filepath}"
                 elsif cmd == "SUCC" then
                     @log.info "Client downloaded file successfully"
@@ -516,10 +518,12 @@ class BuildCommClient
                     ftp_filepath = tok[1].strip
                                        @log.info "Server uploaded file sucessfully"                                    
                                        dst_filepath = nil
-                                       ATTEMPTS.each do |attempt|
+                                       for attempt in ATTEMPTS
                            dst_filepath = FileTransfer.getfile(ip, port, username, passwd, ftp_filepath, dst_file, @log)
                                                if not dst_filepath.nil? then break
-                                               else "Client is the #{attempt} download attempt fails" end                                                      
+                                               else 
+                                                       @log.warn "Client is the #{attempt} download attempt fails" 
+                                               end                                                     
                                        end                                     
                                        if dst_filepath.nil? then 
                                                send "ERROR"