error reovery bugfix set

git-svn-id: svn://code.dyne.org/veejay/trunk@801 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-02-17 17:31:07 +00:00
parent 7cdbb48b77
commit 4fe099f75b
5 changed files with 40 additions and 16 deletions

View File

@@ -2973,7 +2973,7 @@ void SaveCurrentPlaying( xmlNodePtr node, int id, int mode )
(const xmlChar*) buffer ); (const xmlChar*) buffer );
sprintf(buffer, "%d", mode ); sprintf(buffer, "%d", mode );
xmlNewChild(node,NULL, (const xmlChar*) "PLAYING_MODE", xmlNewChild(node,NULL, (const xmlChar*) "PLAYING_MODE",
(const xmlChar*) mode ); (const xmlChar*) buffer );
} }

View File

@@ -298,9 +298,9 @@ int vj_server_send( vj_server *vje, int link_id, uint8_t *buf, int len )
total = sock_t_send_fd( Link[link_id]->handle, vje->send_size, buf, len, 0); total = sock_t_send_fd( Link[link_id]->handle, vje->send_size, buf, len, 0);
if( total <= 0 ) if( total <= 0 )
{ {
veejay_msg(0,"Unable to send buffer to %s:%s", veejay_msg(0,"Unable to send buffer to %s:%s ",
(char*)(inet_ntoa(vje->remote.sin_addr)),strerror(errno)); (char*)(inet_ntoa(vje->remote.sin_addr)),strerror(errno));
return 0; return -1;
} }
} }
else else
@@ -377,7 +377,7 @@ static int vj_server_send_frame_now( vj_server *vje, int link_id, uint8_t *buf,
total = sock_t_send_fd( Link[link_id]->handle, vje->send_size, buf, len, 0); total = sock_t_send_fd( Link[link_id]->handle, vje->send_size, buf, len, 0);
if( total <= 0 ) if( total <= 0 )
{ {
veejay_msg(0,"Unable to send buffer to %s:%s", veejay_msg(0,"Unable to send buffer to %s: %s",
(char*)(inet_ntoa(vje->remote.sin_addr)),strerror(errno)); (char*)(inet_ntoa(vje->remote.sin_addr)),strerror(errno));
return 0; return 0;
} }
@@ -852,9 +852,14 @@ int vj_server_update( vj_server *vje, int id )
if(!vje->use_mcast) if(!vje->use_mcast)
{ {
n = recv( sock_fd, vje->recv_buf, RECV_SIZE, 0 ); n = recv( sock_fd, vje->recv_buf, RECV_SIZE, 0 );
if( n <= 0) if( n < 0)
{ {
veejay_msg(VEEJAY_MSG_ERROR, "Receive error: %s", strerror(errno)); // veejay_msg(VEEJAY_MSG_ERROR, "Receive error: %s", strerror(errno));
return -1;
}
if( n == 0 )
{
veejay_msg(VEEJAY_MSG_INFO ,"Connection closed by remote");
return -1; return -1;
} }
} }
@@ -862,8 +867,10 @@ int vj_server_update( vj_server *vje, int id )
{ {
vj_proto **proto = (vj_proto**) vje->protocol; vj_proto **proto = (vj_proto**) vje->protocol;
n = mcast_recv( proto[0]->r, (void*) vje->recv_buf, RECV_SIZE ); n = mcast_recv( proto[0]->r, (void*) vje->recv_buf, RECV_SIZE );
if( n <= 0 ) if( n < 0 )
return 0; return -1;
if( n == 0 )
return -1;
} }

View File

@@ -191,6 +191,7 @@ struct mjpeg_params
//#include <videodev_mjpeg.h> //#include <videodev_mjpeg.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h>
#ifdef HAVE_SDL #ifdef HAVE_SDL
#include <SDL/SDL.h> #include <SDL/SDL.h>
#define MAX_SDL_OUT 2 #define MAX_SDL_OUT 2
@@ -1288,13 +1289,7 @@ void veejay_handle_signal(void *arg, int sig)
else else
veejay_change_state( info, LAVPLAY_STATE_STOP ); veejay_change_state( info, LAVPLAY_STATE_STOP );
if( sig == SIGSEGV || sig == SIGFPE || sig == SIGBUS || sig == SIGPWR || sig == SIGABRT) signal( sig, SIG_DFL );
signal( sig, SIG_DFL );
else
{
veejay_msg(VEEJAY_MSG_DEBUG, "Broken pipe");
signal( sig, SIG_IGN );
}
} }
} }
} }
@@ -1321,6 +1316,11 @@ void vj_unlock(veejay_t *info)
pthread_mutex_unlock(&(settings->valid_mutex)); pthread_mutex_unlock(&(settings->valid_mutex));
} }
static void donothing2(int sig)
{
veejay_msg(0,"Catch signal %d",sig );
}
static void *veejay_mjpeg_playback_thread(void *arg) static void *veejay_mjpeg_playback_thread(void *arg)
{ {
@@ -1331,6 +1331,18 @@ static void *veejay_mjpeg_playback_thread(void *arg)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
sigset_t mask;
struct sigaction act;
sigemptyset(&mask);
sigaddset( &mask, SIGPIPE );
act.sa_handler = donothing2;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
pthread_sigmask( SIG_BLOCK, &mask, NULL );
/* schedule FIFO */ /* schedule FIFO */
veejay_schedule_fifo( info, getpid()); veejay_schedule_fifo( info, getpid());

View File

@@ -717,6 +717,9 @@ int main(int argc, char **argv)
action.sa_handler = donothing; action.sa_handler = donothing;
action.sa_mask = allsignals; action.sa_mask = allsignals;
action.sa_flags = SA_RESTART | SA_RESETHAND; action.sa_flags = SA_RESTART | SA_RESETHAND;
signal( SIGPIPE, SIG_IGN );
for( i = 1; i < NSIG; i ++ ) for( i = 1; i < NSIG; i ++ )
if( sigismember( &(settings->signal_set), i )) if( sigismember( &(settings->signal_set), i ))
sigaction( i, &action, 0 ); sigaction( i, &action, 0 );

View File

@@ -284,7 +284,9 @@ veejay_msg(VEEJAY_MSG_INFO, "---------------------------------------------------
#define SEND_MSG(v,str)\ #define SEND_MSG(v,str)\
{\ {\
vj_server_send(v->vjs[VEEJAY_PORT_CMD], v->uc->current_link, str, strlen(str));\ if(vj_server_send(v->vjs[VEEJAY_PORT_CMD], v->uc->current_link, str, strlen(str)) < 0) { \
_vj_server_del_client( v->vjs[VEEJAY_PORT_CMD], v->uc->current_link); \
_vj_server_del_client( v->vjs[VEEJAY_PORT_STA], v->uc->current_link);} \
} }
#define RAW_SEND_MSG(v,str,len)\ #define RAW_SEND_MSG(v,str,len)\
{\ {\