diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2016-04-14 10:54:05 +0100 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@redhat.com> | 2016-04-15 09:50:18 -0500 |
commit | c1b7f67b820d9070281af4ea24a9b3b3fbf84cfb (patch) | |
tree | 3e1a5080707ce1fe7dbbe80c7c71bd555146de5b /server/red-channel.h | |
parent | b3aebf913623ed4c8cb7eb03380c0f3f2b7c42d6 (diff) |
Add reference counting to PipeItem class
A user-defined callback is called when the refcount drops to 0.
Reference counting is manually coded for several classes deriving from
PipeItem, so this change will help to share this code, and allow to remove
some ref/unref virtual functions in some interfaces when we can assume
every instance derives from this base class.
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'server/red-channel.h')
-rw-r--r-- | server/red-channel.h | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/server/red-channel.h b/server/red-channel.h index 94b09eb2..3c762ff6 100644 --- a/server/red-channel.h +++ b/server/red-channel.h @@ -33,6 +33,7 @@ #include "demarshallers.h" #include "reds-stream.h" #include "stat.h" +#include "red-pipe-item.h" #define MAX_SEND_BUFS 1000 #define CLIENT_ACK_WINDOW 20 @@ -147,16 +148,6 @@ enum { PIPE_ITEM_TYPE_CHANNEL_BASE=101, }; -typedef struct PipeItem { - RingItem link; - int type; -} PipeItem; - -static inline int pipe_item_is_linked(PipeItem *item) -{ - return ring_item_is_linked(&item->link); -} - typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannelClient *channel, uint16_t type, uint32_t size); typedef int (*channel_handle_parsed_proc)(RedChannelClient *rcc, uint32_t size, uint16_t type, @@ -473,8 +464,6 @@ int red_channel_client_get_roundtrip_ms(RedChannelClient *rcc); */ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uint32_t timeout_ms); -void pipe_item_init(PipeItem *item, int type); - // TODO: add back the channel_pipe_add functionality - by adding reference counting // to the PipeItem. |