Commit 11f3cbaa authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

remoteosd: inline connect function

No need to duplicate debug from net_Connect()...
parent bcc5917f
...@@ -164,8 +164,6 @@ static void* vnc_worker_thread ( void * ); ...@@ -164,8 +164,6 @@ static void* vnc_worker_thread ( void * );
static void* update_request_thread( void * ); static void* update_request_thread( void * );
static bool open_vnc_connection ( filter_t *p_filter );
static bool handshaking ( filter_t *p_filter ); static bool handshaking ( filter_t *p_filter );
static bool process_server_message ( filter_t *p_filter, static bool process_server_message ( filter_t *p_filter,
...@@ -204,7 +202,6 @@ struct filter_sys_t ...@@ -204,7 +202,6 @@ struct filter_sys_t
uint8_t i_alpha; /* alpha transparency value */ uint8_t i_alpha; /* alpha transparency value */
char *psz_host; /* VNC host */ char *psz_host; /* VNC host */
int i_port;
char *psz_passwd; /* VNC password */ char *psz_passwd; /* VNC password */
...@@ -264,8 +261,6 @@ static int CreateFilter ( vlc_object_t *p_this ) ...@@ -264,8 +261,6 @@ static int CreateFilter ( vlc_object_t *p_this )
goto error; goto error;
} }
p_sys->i_port = var_CreateGetIntegerCommand( p_this, RMTOSD_CFG "port" );
p_sys->i_alpha = var_CreateGetIntegerCommand( p_this, RMTOSD_CFG "alpha" ); p_sys->i_alpha = var_CreateGetIntegerCommand( p_this, RMTOSD_CFG "alpha" );
for ( int i = 0; i < 256; i++ ) for ( int i = 0; i < 256; i++ )
...@@ -335,7 +330,6 @@ static void DestroyFilter( vlc_object_t *p_this ) ...@@ -335,7 +330,6 @@ static void DestroyFilter( vlc_object_t *p_this )
var_DelCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this ); var_DelCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this );
var_Destroy( p_this, RMTOSD_CFG "host" ); var_Destroy( p_this, RMTOSD_CFG "host" );
var_Destroy( p_this, RMTOSD_CFG "port" );
var_Destroy( p_this, RMTOSD_CFG "password" ); var_Destroy( p_this, RMTOSD_CFG "password" );
var_Destroy( p_this, RMTOSD_CFG "mouse-events" ); var_Destroy( p_this, RMTOSD_CFG "mouse-events" );
var_Destroy( p_this, RMTOSD_CFG "key-events" ); var_Destroy( p_this, RMTOSD_CFG "key-events" );
...@@ -376,26 +370,6 @@ static bool write_exact( filter_t *p_filter, ...@@ -376,26 +370,6 @@ static bool write_exact( filter_t *p_filter,
return i_bytes == net_Write( p_filter, i_socket, p_writebuf, i_bytes ); return i_bytes == net_Write( p_filter, i_socket, p_writebuf, i_bytes );
} }
static bool open_vnc_connection ( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
msg_Dbg( p_filter, "Open socket to vnc server on %s:%u.",
p_sys->psz_host, p_sys->i_port );
p_sys->i_socket = net_ConnectTCP( p_filter, p_sys->psz_host, p_sys->i_port );
if( p_sys->i_socket < 0 )
{
msg_Err( p_filter, "Could not open socket" );
return false;
}
msg_Dbg( p_filter, "socket is open." );
return true;
}
static bool handshaking ( filter_t *p_filter ) static bool handshaking ( filter_t *p_filter )
{ {
filter_sys_t *p_sys = p_filter->p_sys; filter_sys_t *p_sys = p_filter->p_sys;
...@@ -637,10 +611,13 @@ static void* vnc_worker_thread( void *obj ) ...@@ -637,10 +611,13 @@ static void* vnc_worker_thread( void *obj )
msg_Dbg( p_filter, "VNC worker thread started" ); msg_Dbg( p_filter, "VNC worker thread started" );
if( !open_vnc_connection ( p_filter ) ) int i_port = var_InheritInteger( p_filter, RMTOSD_CFG "port" );
p_sys->i_socket = net_ConnectTCP( p_filter, p_sys->psz_host, i_port );
if( p_sys->i_socket == -1 )
{ {
msg_Err( p_filter, "Could not connect to vnc host" ); msg_Err( p_filter, "Could not connect to VNC host" );
goto exit; return NULL;
} }
if( !handshaking ( p_filter ) ) if( !handshaking ( p_filter ) )
...@@ -742,8 +719,7 @@ exit: ...@@ -742,8 +719,7 @@ exit:
vlc_mutex_lock( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock );
p_sys->b_connection_active = false; p_sys->b_connection_active = false;
if (p_sys->i_socket >= 0) net_Close(p_sys->i_socket);
net_Close(p_sys->i_socket);
if( p_sys->p_pic ) if( p_sys->p_pic )
picture_Release( p_sys->p_pic ); picture_Release( p_sys->p_pic );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment