[Title] dibs register print progress bar
authorhataejun <taejun.ha@samsung.com>
Mon, 11 Mar 2013 02:31:27 +0000 (11:31 +0900)
committerhataejun <taejun.ha@samsung.com>
Mon, 11 Mar 2013 02:31:27 +0000 (11:31 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#] 8668
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I309ac24a5cba6a63b950d8aa933828cb06abe8c0

src/common/FileTransferViaDirect.rb
src/common/log.rb
src/pkg_server/client.rb

index d45f79e0c91ae6cd048b84f42a48507b39ad6c90..744c6f60cd2d060da0273e12cf999897bce25dca 100644 (file)
@@ -59,6 +59,9 @@ class FileTransferDirect
                        case cmd
                        when "SEND_REQ"
                                conn.puts "FILE_INFO,#{filename},#{size},#{checksum}"
+
+                               full_size = size
+                               old_progress = 0
                                # read file contents
                                # send via tcp/ip
                                File.open(src_file, "rb") do |io|
@@ -66,6 +69,12 @@ class FileTransferDirect
                                                buf = io.read(size > 1024*1024 ? 1024*1024 : size)
                                                conn.write( buf )
                                                size -= buf.length
+
+                                               progress = ((( full_size - size ) * 10 ) / full_size )
+                                               if not progress.eql? old_progress then
+                                                       @log.info "File transfer : #{progress}0 %"
+                                                       old_progress = progress
+                                               end
                                        end
                                end
 
index 893885fb3015f9fd9b9fd24ca8af65bfc92c5d21..3ea5ef43774d98b926d1430da0508c9680d9bef7 100644 (file)
@@ -96,7 +96,6 @@ class Log
                @cnt = @cnt + 1
        end
 
-
        def close
                @second_out= nil
        end
index 0a36176db7a4421c8d85218879ee76a8cdd49f20..bb94695e73deb2ffbebc158dcf30170aaf4ac413 100644 (file)
@@ -370,7 +370,7 @@ class Client
                                        raise RuntimeError, "Failed to create BuildCommClient instance.."
                                end
                 
-                               @log.info "Send ready REQ..  [UPLOAD]"
+                               @log.info "Send UPLOAD REQ..  [UPLOAD|#{dock}]"
                                result = client2.send("UPLOAD|#{dock}")
                                if not result then
                                        raise RuntimeError, "Failed to send ready REQ.."
@@ -423,7 +423,7 @@ class Client
 
                client = BuildCommClient.create(ip, port, @log)
                if client.nil? then
-                       puts "Can't access server #{ip}:#{port}"
+                       @log.error "Can't access server #{ip}:#{port}"
                        return nil
                end
 
@@ -445,6 +445,7 @@ class Client
                        client.read_lines do |line|
                                if line.eql?("WAITFORUPLOAD") then
                                        # upload
+                                       @log.info "Get WAITFORUPLOAD message"
                                        thread = Thread.new do
                                                begin 
                                                        upload_request(ip, port, dock, transporter, binary_path_list)