From 0bf518cd3daad526a16468e82c1d6c715535e9ba Mon Sep 17 00:00:00 2001 From: Yonit Halperin Date: Wed, 5 Oct 2011 09:05:13 +0200 Subject: server: set & test channel capabilities in red_channel The code for setting and testing channel capabilities was unnecessarily duplicated. Now it is in red_channel. RedsChannel was dropped from Reds; It was used only for holding the channels common capabilities, which are now held in RedChannel. --- server/main_channel.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'server/main_channel.h') diff --git a/server/main_channel.h b/server/main_channel.h index 713bcd09..2ae05e8b 100644 --- a/server/main_channel.h +++ b/server/main_channel.h @@ -45,7 +45,20 @@ struct MainMigrateData { uint32_t write_queue_size; }; -typedef struct MainChannel MainChannel; +// TODO: Defines used to calculate receive buffer size, and also by reds.c +// other options: is to make a reds_main_consts.h, to duplicate defines. +#define REDS_AGENT_WINDOW_SIZE 10 +#define REDS_NUM_INTERNAL_AGENT_MESSAGES 1 + +// approximate max receive message size for main channel +#define RECEIVE_BUF_SIZE \ + (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE) + +typedef struct MainChannel { + RedChannel base; + uint8_t recv_buf[RECEIVE_BUF_SIZE]; +} MainChannel; + MainChannel *main_channel_init(void); RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t link_id); @@ -82,9 +95,4 @@ int main_channel_client_is_low_bandwidth(MainChannelClient *mcc); uint64_t main_channel_client_get_bitrate_per_sec(MainChannelClient *mcc); int main_channel_is_connected(MainChannel *main_chan); -// TODO: Defines used to calculate receive buffer size, and also by reds.c -// other options: is to make a reds_main_consts.h, to duplicate defines. -#define REDS_AGENT_WINDOW_SIZE 10 -#define REDS_NUM_INTERNAL_AGENT_MESSAGES 1 - #endif -- cgit