Re: [spice-gtk][PATCH] Added INFO messages about a file transfer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2014-09-16 at 16:47 -0500, Jonathon Jongsma wrote:
> On Mon, 2014-09-15 at 12:07 +0200, Pavel Grunt wrote:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1140512
> > 
> > When a file transfer starts / finishes an information message is printed (in INFO log level)
> > 
> > ---
> >  gtk/channel-main.c | 23 +++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> > 
> > diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> > index 021fa83..7a59613 100644
> > --- a/gtk/channel-main.c
> > +++ b/gtk/channel-main.c
> > @@ -70,6 +70,7 @@ typedef struct SpiceFileXferTask {
> >      char                           buffer[FILE_XFER_CHUNK_SIZE];
> >      uint64_t                       read_bytes;
> >      uint64_t                       file_size;
> > +    GDateTime                      *start_time;
> >      GError                         *error;
> >  } SpiceFileXferTask;
> >  
> > @@ -1538,6 +1539,7 @@ static void file_xfer_task_free(SpiceFileXferTask *task)
> >      g_clear_object(&task->channel);
> >      g_clear_object(&task->file);
> >      g_clear_object(&task->file_stream);
> > +    g_date_time_unref(task->start_time);
> >      g_free(task);
> >  }
> >  
> > @@ -1548,6 +1550,9 @@ static void file_xfer_close_cb(GObject      *object,
> >  {
> >      GSimpleAsyncResult *res;
> >      SpiceFileXferTask *task;
> > +    GDateTime *end;
> > +    char *basename;
> > +    double seconds;
> >      GError *error = NULL;
> >  
> >      task = user_data;
> > @@ -1572,6 +1577,17 @@ static void file_xfer_close_cb(GObject      *object,
> >          g_simple_async_result_take_error(res, task->error);
> >          g_simple_async_result_set_op_res_gboolean(res, FALSE);
> >      } else {
> > +        end = g_date_time_new_now_local();
> > +        seconds = (double) g_date_time_difference(end, task->start_time) / 1000000.0;
> > +        g_date_time_unref(end);
> > +        basename = g_file_get_basename(task->file);
> > +        if (basename != NULL) {
> > +            g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, 
> > +                  "transferred file %s of %.2f kB size in %.2f seconds (%.1f MB/s)",
> > +                   basename, task->file_size / 1000.0, seconds, 
> > +                   (task->file_size/1000000.0)/seconds);
> > +            g_free(basename);
> > +        }
> >          g_simple_async_result_set_op_res_gboolean(res, TRUE);
> >      }
> >      g_simple_async_result_complete_in_idle(res);
> > @@ -2739,6 +2755,7 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
> >  {
> >      SpiceMainChannelPrivate *c = channel->priv;
> >      SpiceFileXferTask *task;
> > +    char *basename;
> >      static uint32_t xfer_id;    /* Used to identify task id */
> >  
> >      task = g_malloc0(sizeof(SpiceFileXferTask));
> > @@ -2751,7 +2768,13 @@ static void file_xfer_send_start_msg_async(SpiceMainChannel *channel,
> >      task->progress_callback_data = progress_callback_data;
> >      task->callback = callback;
> >      task->user_data = user_data;
> > +    task->start_time = g_date_time_new_now_local();
> >  
> > +    basename = g_file_get_basename(task->file);
> > +    if (basename != NULL) {
> > +        g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "transfer of file %s has started", basename);
> > +        g_free(basename);
> > +    }
> >      CHANNEL_DEBUG(task->channel, "Insert a xfer task:%d to task list", task->id);
> >      g_hash_table_insert(c->file_xfer_tasks, GUINT_TO_POINTER(task->id), task);
> >  
> 
> 
> ACK. patch looks fine to me. Thanks.


Please, do *not* push this patch.
Seems that David Jasa asked Pavel to improve a few things, he will
submit a v2.

Best Regards,
--
Fabiano Fidêncio

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]