[Spice-devel,spice-server] Add a comment to red_channel_client_init_send_data

Submitted by Frediano Ziglio on Nov. 24, 2016, 10:48 a.m.

Details

Message ID 20161124104824.10884-3-fziglio@redhat.com
State New
Headers show
Series "dcc: Remove unneeded private header inclusion" ( rev: 3 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 24, 2016, 10:48 a.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/red-channel-client.h | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 94b4f58..93d0315 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -89,6 +89,9 @@  void red_channel_client_shutdown(RedChannelClient *rcc);
 int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size,
                                       uint16_t type, void *message);
 /* when preparing send_data: should call init and then use marshaller */
+/* item is retained as long as the message is sent to the client,
+ * this is used for instance to make sure an attached data referenced
+ * by the marshaller is still valid when data are used */
 void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item);
 
 uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);

Comments

On Thu, Nov 24, 2016 at 10:48:24AM +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  server/red-channel-client.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> index 94b4f58..93d0315 100644
> --- a/server/red-channel-client.h
> +++ b/server/red-channel-client.h
> @@ -89,6 +89,9 @@ void red_channel_client_shutdown(RedChannelClient *rcc);
>  int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size,
>                                        uint16_t type, void *message);
>  /* when preparing send_data: should call init and then use marshaller */
> +/* item is retained as long as the message is sent to the client,

"The item is retained", then I don't understand when the item stops
being retained. "The item is only released after the message has been
sent to the client" ?

> + * this is used for instance to make sure an attached data referenced

"This is used for instance to make sure attached data ..."

> + * by the marshaller is still valid when data are used */

and I would say "when it's used"

Maybe better to wait for Jonathon's input on the phrasing?

Christophe
> 
> On Thu, Nov 24, 2016 at 10:48:24AM +0000, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> >  server/red-channel-client.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> > index 94b4f58..93d0315 100644
> > --- a/server/red-channel-client.h
> > +++ b/server/red-channel-client.h
> > @@ -89,6 +89,9 @@ void red_channel_client_shutdown(RedChannelClient *rcc);
> >  int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t
> >  size,
> >                                        uint16_t type, void *message);
> >  /* when preparing send_data: should call init and then use marshaller */
> > +/* item is retained as long as the message is sent to the client,
> 
> "The item is retained", then I don't understand when the item stops
> being retained. "The item is only released after the message has been
> sent to the client" ?
> 
> > + * this is used for instance to make sure an attached data referenced
> 
> "This is used for instance to make sure attached data ..."
> 
> > + * by the marshaller is still valid when data are used */
> 
> and I would say "when it's used"
> 
> Maybe better to wait for Jonathon's input on the phrasing?
> 
> Christophe
> 

I'll wait, in the meantime I updated the commit log.

What's not clear with this API is when to pass the item and when not.
Basically when there is a spice_marshaller_add_ref in the code that
send the item potentially it's required to pass the item to
red_channel_client_init_send_data, otherwise passing NULL will free
the item when *_send_item returns (if not references elsewhere).

Frediano