Merge pull request #2016 from matt335672/neutrinordp_fix_query_channel

Remove unnecessary error from neutrinordp log #2016
This commit is contained in:
matt335672 2021-10-13 09:36:12 +01:00 committed by GitHub
commit 24bb730d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 17 deletions

View File

@ -79,6 +79,7 @@ struct mod
int box_right, int box_bottom,
int x, int y, char *data, int data_len);
int (*server_reset)(struct mod *v, int width, int height, int bpp);
int (*server_get_channel_count)(struct mod *v);
int (*server_query_channel)(struct mod *v, int index,
char *channel_name,
int *channel_flags);
@ -88,7 +89,7 @@ struct mod
int total_data_len, int flags);
int (*server_bell_trigger)(struct mod *v);
int (*server_chansrv_in_use)(struct mod *v);
tintptr server_dumby[100 - 26]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 27]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -1749,21 +1749,34 @@ lfreerdp_pre_connect(freerdp *instance)
LOG_DEVEL(LOG_LEVEL_INFO, "lfreerdp_pre_connect:");
mod = ((struct mod_context *)(instance->context))->modi;
verifyColorMap(mod);
num_chans = 0;
index = 0;
error = mod->server_query_channel(mod, index, ch_name, &ch_flags);
while (error == 0)
num_chans = mod->server_get_channel_count(mod);
if (num_chans < 0)
{
LOG(LOG_LEVEL_ERROR, "lfreerdp_pre_connect: Can't get channel count");
num_chans = 0;
}
for (index = 0 ; index < num_chans; ++index)
{
num_chans++;
LOG_DEVEL(LOG_LEVEL_DEBUG, "lfreerdp_pre_connect: got channel [%s], id [%d], flags [0x%8.8x]",
ch_name, index, ch_flags);
dst_ch_name = instance->settings->channels[index].name;
g_memset(dst_ch_name, 0, 8);
g_snprintf(dst_ch_name, 8, "%s", ch_name);
instance->settings->channels[index].options = ch_flags;
index++;
error = mod->server_query_channel(mod, index, ch_name, &ch_flags);
if (error == 0)
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "lfreerdp_pre_connect: "
"got channel [%s], id [%d], flags [0x%8.8x]",
ch_name, index, ch_flags);
dst_ch_name = instance->settings->channels[index].name;
g_memset(dst_ch_name, 0, 8);
g_snprintf(dst_ch_name, 8, "%s", ch_name);
instance->settings->channels[index].options = ch_flags;
}
else
{
LOG(LOG_LEVEL_ERROR, "lfreerdp_pre_connect: "
"Expected %d channels, got %d",
num_chans, index);
num_chans = index;
}
}
instance->settings->num_channels = num_chans;

View File

@ -131,6 +131,7 @@ struct mod
int box_right, int box_bottom,
int x, int y, char *data, int data_len);
int (*server_reset)(struct mod *v, int width, int height, int bpp);
int (*server_get_channel_count)(struct mod *v);
int (*server_query_channel)(struct mod *v, int index,
char *channel_name,
int *channel_flags);
@ -194,7 +195,7 @@ struct mod
int flags, int frame_id);
int (*server_session_info)(struct mod *v, const char *data,
int data_bytes);
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 46]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -123,6 +123,7 @@ struct vnc
int box_right, int box_bottom,
int x, int y, char *data, int data_len);
int (*server_reset)(struct vnc *v, int width, int height, int bpp);
int (*server_get_channel_count)(struct vnc *v);
int (*server_query_channel)(struct vnc *v, int index,
char *channel_name,
int *channel_flags);
@ -132,7 +133,7 @@ struct vnc
int total_data_len, int flags);
int (*server_bell_trigger)(struct vnc *v);
int (*server_chansrv_in_use)(struct vnc *v);
tintptr server_dumby[100 - 26]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 27]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */

View File

@ -513,6 +513,8 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp);
int
is_channel_allowed(struct xrdp_wm *wm, int channel_id);
int
server_get_channel_count(struct xrdp_mod *mod);
int
server_query_channel(struct xrdp_mod *mod, int index, char *channel_name,
int *channel_flags);
int

View File

@ -448,6 +448,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
self->mod->server_add_char = server_add_char;
self->mod->server_draw_text = server_draw_text;
self->mod->server_reset = server_reset;
self->mod->server_get_channel_count = server_get_channel_count;
self->mod->server_query_channel = server_query_channel;
self->mod->server_get_channel_id = server_get_channel_id;
self->mod->server_send_to_channel = server_send_to_channel;
@ -3568,6 +3569,24 @@ server_reset(struct xrdp_mod *mod, int width, int height, int bpp)
return 0;
}
/*****************************************************************************/
/*return -1 if channels are controlled by chansrv */
int
server_get_channel_count(struct xrdp_mod *mod)
{
struct xrdp_wm *wm;
wm = (struct xrdp_wm *)(mod->wm);
if (wm->mm->usechansrv)
{
return -1;
}
return libxrdp_get_channel_count(wm->session);
}
/*****************************************************************************/
/*return 0 if the index is not found*/
int

View File

@ -95,6 +95,7 @@ struct xrdp_mod
int box_right, int box_bottom,
int x, int y, char *data, int data_len);
int (*server_reset)(struct xrdp_mod *v, int width, int height, int bpp);
int (*server_get_channel_count)(struct xrdp_mod *v);
int (*server_query_channel)(struct xrdp_mod *v, int index,
char *channel_name,
int *channel_flags);
@ -159,7 +160,7 @@ struct xrdp_mod
int flags, int frame_id);
int (*server_session_info)(struct xrdp_mod *v, const char *data,
int data_bytes);
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 46]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as int */

View File

@ -92,6 +92,7 @@ struct mod
int box_right, int box_bottom,
int x, int y, char *data, int data_len);
int (*server_reset)(struct mod *v, int width, int height, int bpp);
int (*server_get_channel_count)(struct mod *v);
int (*server_query_channel)(struct mod *v, int index,
char *channel_name,
int *channel_flags);
@ -152,7 +153,7 @@ struct mod
char *data, int width, int height,
int flags, int frame_id);
tintptr server_dumby[100 - 44]; /* align, 100 minus the number of server
tintptr server_dumby[100 - 45]; /* align, 100 minus the number of server
functions above */
/* common */
tintptr handle; /* pointer to self as long */