Add optional fd parameter to mod_connect() method
The fd parameter can be used to immediately connect to a display server, if an fd was obtained from sesman
This commit is contained in:
@@ -261,7 +261,7 @@ lib_send_client_info(struct mod *mod)
|
||||
/******************************************************************************/
|
||||
/* return error */
|
||||
static int
|
||||
lib_mod_connect(struct mod *mod)
|
||||
lib_mod_connect(struct mod *mod, int fd)
|
||||
{
|
||||
int error;
|
||||
int socket_mode;
|
||||
@@ -356,8 +356,19 @@ lib_mod_connect(struct mod *mod)
|
||||
mod->trans->no_stream_init_on_data_in = 1;
|
||||
mod->trans->extra_flags = 1;
|
||||
|
||||
/* Give the X server a bit of time to start */
|
||||
error = trans_connect(mod->trans, mod->ip, con_port, 30 * 1000);
|
||||
if (fd >= 0)
|
||||
{
|
||||
mod->trans->sck = fd;
|
||||
mod->trans->status = TRANS_STATUS_UP; /* ok */
|
||||
mod->trans->type1 = TRANS_TYPE_CLIENT; /* client */
|
||||
error = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Give the X server a bit of time to start */
|
||||
error = trans_connect(mod->trans, mod->ip, con_port, 30 * 1000);
|
||||
}
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "lib_mod_connect: connected to Xserver "
|
||||
|
||||
@@ -53,7 +53,7 @@ struct mod
|
||||
int version; /* internal version */
|
||||
/* client functions */
|
||||
int (*mod_start)(struct mod *v, int w, int h, int bpp);
|
||||
int (*mod_connect)(struct mod *v);
|
||||
int (*mod_connect)(struct mod *v, int fd);
|
||||
int (*mod_event)(struct mod *v, int msg, tbus param1, tbus param2,
|
||||
tbus param3, tbus param4);
|
||||
int (*mod_signal)(struct mod *v);
|
||||
|
||||
Reference in New Issue
Block a user