Commit f4012b9f authored by Marc Ariberti's avatar Marc Ariberti

On sam's advice I added the input_FDNetworkClose() function to be called

when closing a  networking stream instead of input_FDClose().  It is due
to WIN32  because we have  to call  closesocket() instead of  close() to
close the socket. The problem was  : windows did not leave the multicast
group when closing the socket.

  * input_ext-plugins.c : where is located the function
  * *.h : function declaration
  * udp.c, http.c : these modules now call input_FDNetworkClose()
parent 51ec06db
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions * Collection of useful common types and macros definitions
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.105 2002/05/14 19:33:54 bozo Exp $ * $Id: common.h,v 1.106 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Samuel Hocevar <sam@via.ecp.fr> * Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -643,6 +643,7 @@ typedef struct module_symbols_s ...@@ -643,6 +643,7 @@ typedef struct module_symbols_s
mtime_t ); mtime_t );
void ( * input_FDSeek ) ( struct input_thread_s *, off_t ); void ( * input_FDSeek ) ( struct input_thread_s *, off_t );
void ( * input_FDClose ) ( struct input_thread_s * ); void ( * input_FDClose ) ( struct input_thread_s * );
void ( * input_FDNetworkClose ) ( struct input_thread_s * );
ssize_t ( * input_FDRead ) ( struct input_thread_s *, byte_t *, ssize_t ( * input_FDRead ) ( struct input_thread_s *, byte_t *,
size_t ); size_t );
ssize_t ( * input_FDNetworkRead ) ( struct input_thread_s *, byte_t *, ssize_t ( * input_FDNetworkRead ) ( struct input_thread_s *, byte_t *,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* but exported to plug-ins * but exported to plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* $Id: input_ext-plugins.h,v 1.26 2002/05/14 21:23:44 massiot Exp $ * $Id: input_ext-plugins.h,v 1.27 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -343,11 +343,13 @@ typedef struct input_socket_s ...@@ -343,11 +343,13 @@ typedef struct input_socket_s
*****************************************************************************/ *****************************************************************************/
#ifndef __PLUGIN__ #ifndef __PLUGIN__
void input_FDClose( struct input_thread_s * ); void input_FDClose( struct input_thread_s * );
void input_FDNetworkClose( struct input_thread_s * );
ssize_t input_FDRead( input_thread_t *, byte_t *, size_t ); ssize_t input_FDRead( input_thread_t *, byte_t *, size_t );
ssize_t input_FDNetworkRead( input_thread_t *, byte_t *, size_t ); ssize_t input_FDNetworkRead( input_thread_t *, byte_t *, size_t );
void input_FDSeek( struct input_thread_s *, off_t ); void input_FDSeek( struct input_thread_s *, off_t );
#else #else
# define input_FDClose p_symbols->input_FDClose # define input_FDClose p_symbols->input_FDClose
# define input_FDNetworkClose p_symbols->input_FDNetworkClose
# define input_FDRead p_symbols->input_FDRead # define input_FDRead p_symbols->input_FDRead
# define input_FDNetworkRead p_symbols->input_FDNetworkRead # define input_FDNetworkRead p_symbols->input_FDNetworkRead
# define input_FDSeek p_symbols->input_FDSeek # define input_FDSeek p_symbols->input_FDSeek
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c: HTTP access plug-in * http.c: HTTP access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: http.c,v 1.8 2002/04/19 13:56:10 sam Exp $ * $Id: http.c,v 1.9 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -144,7 +144,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -144,7 +144,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
strlen( psz_buffer ) ) == (-1) ) strlen( psz_buffer ) ) == (-1) )
{ {
intf_ErrMsg( "http error: cannot send request (%s)", strerror(errno) ); intf_ErrMsg( "http error: cannot send request (%s)", strerror(errno) );
input_FDClose( p_input ); input_FDNetworkClose( p_input );
return( -1 ); return( -1 );
} }
...@@ -157,7 +157,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -157,7 +157,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
{ {
if( p_input->b_die || p_input->b_error ) if( p_input->b_die || p_input->b_error )
{ {
input_FDClose( p_input ); input_FDNetworkClose( p_input );
return( -1 ); return( -1 );
} }
} }
...@@ -169,7 +169,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell ) ...@@ -169,7 +169,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
if( input_Peek( p_input, &psz_parser, MAX_LINE ) <= 0 ) if( input_Peek( p_input, &psz_parser, MAX_LINE ) <= 0 )
{ {
intf_ErrMsg( "http error: not enough data" ); intf_ErrMsg( "http error: not enough data" );
input_FDClose( p_input ); input_FDNetworkClose( p_input );
return( -1 ); return( -1 );
} }
...@@ -419,7 +419,7 @@ static int HTTPOpen( input_thread_t * p_input ) ...@@ -419,7 +419,7 @@ static int HTTPOpen( input_thread_t * p_input )
*****************************************************************************/ *****************************************************************************/
static void HTTPClose( input_thread_t * p_input ) static void HTTPClose( input_thread_t * p_input )
{ {
input_FDClose( p_input ); input_FDNetworkClose( p_input );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* udp.c: raw UDP access plug-in * udp.c: raw UDP access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.9 2002/04/19 13:56:10 sam Exp $ * $Id: udp.c,v 1.10 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -83,7 +83,7 @@ static void input_getfunctions( function_list_t * p_function_list ) ...@@ -83,7 +83,7 @@ static void input_getfunctions( function_list_t * p_function_list )
#define input p_function_list->functions.access #define input p_function_list->functions.access
input.pf_open = UDPOpen; input.pf_open = UDPOpen;
input.pf_read = input_FDNetworkRead; input.pf_read = input_FDNetworkRead;
input.pf_close = input_FDClose; input.pf_close = input_FDNetworkClose;
input.pf_set_program = input_SetProgram; input.pf_set_program = input_SetProgram;
input.pf_set_area = NULL; input.pf_set_area = NULL;
input.pf_seek = NULL; input.pf_seek = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-plugins.c: useful functions for access and demux plug-ins * input_ext-plugins.c: useful functions for access and demux plug-ins
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: input_ext-plugins.c,v 1.6 2002/04/24 00:36:24 sam Exp $ * $Id: input_ext-plugins.c,v 1.7 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -680,6 +680,26 @@ void input_FDClose( input_thread_t * p_input ) ...@@ -680,6 +680,26 @@ void input_FDClose( input_thread_t * p_input )
free( p_access_data ); free( p_access_data );
} }
/*****************************************************************************
* input_FDNetworkClose: close the target
*****************************************************************************/
void input_FDNetworkClose( input_thread_t * p_input )
{
input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
intf_WarnMsg( 2, "input: closing network `%s/%s:%s'",
p_input->psz_access, p_input->psz_demux, p_input->psz_name );
intf_ErrMsg( "input: socket close : %d", p_access_data->i_handle);
#ifdef WIN32
closesocket( p_access_data->i_handle );
#else
close( p_access_data->i_handle );
#endif
free( p_access_data );
}
/***************************************************************************** /*****************************************************************************
* input_FDRead: standard read on a file descriptor. * input_FDRead: standard read on a file descriptor.
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules_plugin.h : Plugin management functions used by the core application. * modules_plugin.h : Plugin management functions used by the core application.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules_plugin.h,v 1.26 2002/05/14 19:33:54 bozo Exp $ * $Id: modules_plugin.h,v 1.27 2002/05/15 13:07:18 marcari Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -256,6 +256,7 @@ module_error( char *psz_buffer ) ...@@ -256,6 +256,7 @@ module_error( char *psz_buffer )
(p_symbols)->input_ClockGetTS = input_ClockGetTS; \ (p_symbols)->input_ClockGetTS = input_ClockGetTS; \
(p_symbols)->input_FDSeek = input_FDSeek; \ (p_symbols)->input_FDSeek = input_FDSeek; \
(p_symbols)->input_FDClose = input_FDClose; \ (p_symbols)->input_FDClose = input_FDClose; \
(p_symbols)->input_FDNetworkClose = input_FDNetworkClose; \
(p_symbols)->input_FDRead = input_FDRead; \ (p_symbols)->input_FDRead = input_FDRead; \
(p_symbols)->input_FDNetworkRead = input_FDNetworkRead; \ (p_symbols)->input_FDNetworkRead = input_FDNetworkRead; \
(p_symbols)->input_BuffersInit = input_BuffersInit; \ (p_symbols)->input_BuffersInit = input_BuffersInit; \
......
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