[svn r187] Fixes the sg fault on file transfer. trunk
authorrosfran
Mon Dec 04 20:43:16 2006 +0000 (2006-12-04)
branchtrunk
changeset 18608b70ec67aa4
parent 185 1b4e66e09d43
child 187 653d06bca826
[svn r187] Fixes the sg fault on file transfer.
gmyth/src/gmyth_file_transfer.c
gmyth/src/gmyth_monitor_handler.c
     1.1 --- a/gmyth/src/gmyth_file_transfer.c	Mon Dec 04 19:58:40 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_file_transfer.c	Mon Dec 04 20:43:16 2006 +0000
     1.3 @@ -174,6 +174,8 @@
     1.4    GMythFileTransfer *transfer = GMYTH_FILE_TRANSFER (g_object_new (GMYTH_FILE_TRANSFER_TYPE, NULL));
     1.5    
     1.6    transfer->uri = gmyth_uri_new_with_value (uri_str);
     1.7 +  transfer->hostname = g_string_new( gmyth_uri_get_host(transfer->uri) );
     1.8 +  transfer->port = gmyth_uri_get_port( transfer->uri );
     1.9  
    1.10    return transfer;
    1.11  }
    1.12 @@ -187,9 +189,6 @@
    1.13    
    1.14    if ( filename != NULL )
    1.15    {
    1.16 -		transfer->uri = gmyth_uri_new_with_value ( filename );
    1.17 -  	transfer->hostname = g_string_new( gmyth_uri_get_host(transfer->uri) );
    1.18 -  	transfer->port = gmyth_uri_get_port( transfer->uri );
    1.19    	transfer->filename = filename;
    1.20    	gmyth_backend_info_set_path ( transfer->backend_info, filename );
    1.21    }
    1.22 @@ -201,7 +200,8 @@
    1.23  	  transfer->port = gmyth_backend_info_get_port (transfer->backend_info);
    1.24    }
    1.25    
    1.26 -  gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str);
    1.27 +  if ( transfer->uri )  
    1.28 +  	gmyth_debug ("[%s] URI: %s\n", __FUNCTION__, transfer->uri->uri->str);
    1.29  	 
    1.30    gmyth_debug ("hostname: %s, port %d\n", transfer->hostname->str, transfer->port);
    1.31    
     2.1 --- a/gmyth/src/gmyth_monitor_handler.c	Mon Dec 04 19:58:40 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_monitor_handler.c	Mon Dec 04 20:43:16 2006 +0000
     2.3 @@ -208,7 +208,7 @@
     2.4    
     2.5    //GMythMonitorHandler *monitor = (GMythMonitorHandler*)data;
     2.6    
     2.7 -  //*ret = TRUE;
     2.8 +  *ret = TRUE;
     2.9    //myth_control_acquire_context (TRUE);
    2.10    
    2.11    if ( io_channel == NULL ) {
    2.12 @@ -220,7 +220,7 @@
    2.13    
    2.14    while (TRUE) {
    2.15  	  	
    2.16 -	  //condition = g_io_channel_get_buffer_condition( io_channel );
    2.17 +	  condition = g_io_channel_get_buffer_condition( io_channel );
    2.18  	  
    2.19  	  //myth_control_acquire_context (TRUE);
    2.20  	  
    2.21 @@ -232,7 +232,7 @@
    2.22  	  if (condition & G_IO_HUP) {
    2.23  	    gmyth_debug ("Read end of pipe died!\n");
    2.24  	    *ret = FALSE;
    2.25 -	    goto clean_up;
    2.26 +	    //goto clean_up;
    2.27  	  }
    2.28  	    
    2.29  	  if ( ( condition & G_IO_IN ) != 0 ) {
    2.30 @@ -259,6 +259,12 @@
    2.31  	      io_cond = g_io_channel_get_buffer_condition( io_channel );
    2.32  	
    2.33  	    } while ( ( io_cond & G_IO_IN ) != 0 );
    2.34 +	    gmyth_debug ("\n[%s]\tEVENT: Read %d bytes: %s\n\n", __FUNCTION__, recv, byte_array != NULL && byte_array->data != NULL ? (gchar*)byte_array->data : "[no event data]" );
    2.35 +	  }	  
    2.36 +	  
    2.37 +	  if ( byte_array != NULL ) {
    2.38 +	  	g_byte_array_free( byte_array, TRUE );
    2.39 +	  	byte_array = NULL;
    2.40  	  }
    2.41  	  
    2.42  	  g_usleep( 300 );
    2.43 @@ -270,17 +276,11 @@
    2.44     	*ret = FALSE;
    2.45     	goto clean_up;   	
    2.46    }
    2.47 -  gmyth_debug ("\n[%s]\tEVENT: Read %d bytes: %s\n\n", __FUNCTION__, recv, byte_array->data != NULL ? (gchar*)byte_array->data : "[no event data]" );
    2.48    
    2.49    //g_hash_table_insert( monitor->backend_msgs, (gpointer)monitor->actual_index,
    2.50    //				  byte_array->data );
    2.51    
    2.52    //monitor->actual_index += recv;
    2.53 -  
    2.54 -  if ( byte_array != NULL ) {
    2.55 -  	g_byte_array_free( byte_array, TRUE );
    2.56 -  	byte_array = NULL;
    2.57 -  }
    2.58  
    2.59  clean_up:
    2.60