X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmiracle%2Fmiracle_connection.c;h=6bf496cfcbdbd8165ef72a56aec5bd38f44a197e;hb=b917ae819659606f59b3ae761d06ab2095ade658;hp=563a769a0a5be6e26876113514b9ff1f40f0c85a;hpb=9390e8b584f3f717f0a326893c0e37cf187a0a51;p=melted diff --git a/src/miracle/miracle_connection.c b/src/miracle/miracle_connection.c index 563a769..6bf496c 100644 --- a/src/miracle/miracle_connection.c +++ b/src/miracle/miracle_connection.c @@ -147,7 +147,7 @@ static int connection_read( int fd, char *command, int length ) char *cr = strchr( command, '\r'); if ( cr != NULL ) cr[0] = '\0'; - if ( eof_chk || strncmp( command, "BYE", 3 ) == 0 ) + if ( eof_chk || strncasecmp( command, "BYE", 3 ) == 0 ) nchars = 0; return nchars; } @@ -223,7 +223,35 @@ void *parser_thread( void *arg ) while( !error && connection_read( fd, command, 1024 ) ) { - if ( strncmp( command, "STATUS", 6 ) ) + if ( !strncmp( command, "PUSH ", 5 ) ) + { + char temp[ 20 ]; + int bytes; + char *buffer = NULL; + int total = 0; + mlt_service service = NULL; + + connection_read( fd, temp, 20 ); + bytes = atoi( temp ); + buffer = malloc( bytes + 1 ); + while ( total < bytes ) + { + int count = read( fd, buffer + total, bytes - total ); + if ( count >= 0 ) + total += count; + else + break; + } + buffer[ bytes ] = '\0'; + if ( bytes > 0 && total == bytes ) + service = ( mlt_service )mlt_factory_producer( "westley-xml", buffer ); + response = valerie_parser_push( parser, command, service ); + error = connection_send( fd, response ); + valerie_response_close( response ); + mlt_service_close( service ); + free( buffer ); + } + else if ( strncmp( command, "STATUS", 6 ) ) { response = valerie_parser_execute( parser, command ); miracle_log( LOG_INFO, "%s \"%s\" %d", address, command, valerie_response_get_error_code( response ) );