[svn r73] Deals with another kind of MythTV backend messages (changing TV chain).
1.1 --- a/gmyth/src/gmyth_file_transfer.c Tue Nov 07 22:53:53 2006 +0000
1.2 +++ b/gmyth/src/gmyth_file_transfer.c Tue Nov 07 23:11:23 2006 +0000
1.3 @@ -57,7 +57,7 @@
1.4 #define GMYTHTV_RETRIES 1
1.5 #define GMYTHTV_FILE_SIZE 0
1.6
1.7 -#define GMYTHTV_BUFFER_SIZE 8*1024
1.8 +#define GMYTHTV_BUFFER_SIZE 16*1024
1.9
1.10 #define GMYTHTV_VERSION 30
1.11
1.12 @@ -868,15 +868,15 @@
1.13 //g_static_mutex_unlock( &mutex );
1.14 //data = (void*)g_new0( gchar, size );
1.15
1.16 - //g_io_channel_flush( io_channel, NULL );
1.17 + g_io_channel_flush( io_channel_control, NULL );
1.18
1.19 - //g_static_mutex_lock( &mutex );
1.20 + g_static_mutex_lock( &mutex );
1.21
1.22 io_cond = g_io_channel_get_buffer_condition( io_channel );
1.23
1.24 while ( recv < size && !response )//&& ( io_cond & G_IO_IN ) != 0 )
1.25 {
1.26 - g_io_channel_flush( io_channel_control, NULL );
1.27 + //g_io_channel_flush( io_channel_control, NULL );
1.28
1.29 strlist = gmyth_string_list_new();
1.30 gmyth_string_list_append_char_array( strlist, transfer->query->str );
1.31 @@ -885,7 +885,7 @@
1.32 gmyth_string_list_append_int( strlist, remaining );
1.33 gmyth_socket_write_stringlist( transfer->control_sock, strlist );
1.34
1.35 - gint backend_msg_count = 2;
1.36 + gint backend_msg_count = 1;
1.37
1.38 /* iterates until find some non-MythTV backend message */
1.39 do {
1.40 @@ -898,7 +898,8 @@
1.41 sent = 0;
1.42 response = FALSE;
1.43 found_backend_msg = TRUE;
1.44 - }
1.45 + goto clean_up;
1.46 + }
1.47 else
1.48 {
1.49 sent = gmyth_string_list_get_int( strlist, 0 ); // -1 on backend error
1.50 @@ -909,19 +910,19 @@
1.51 "io_cond %s prepared for reading! (G_IO_IN) !!!\n\n", __FUNCTION__,
1.52 recv, sent, ( ( io_cond & G_IO_IN ) != 0 ) ? "IS" : "IS NOT" );
1.53
1.54 - if ( sent == remaining )
1.55 - {
1.56 - //response = ( recv == size );
1.57 - g_print( "[%s]\t\tsent %d, which is equals to requested size = %d\n\n",
1.58 - __FUNCTION__, sent, remaining );
1.59 - }
1.60 - else
1.61 - {
1.62 - g_print( "[%s]\t\tsent %d, which is NOT equals to requested size = %d\n\n",
1.63 - __FUNCTION__, sent, remaining );
1.64 - goto cleanup;
1.65 -
1.66 - }
1.67 + if ( sent == remaining )
1.68 + {
1.69 + //response = ( recv == size );
1.70 + g_print( "[%s]\t\tsent %d, which is equals to requested size = %d\n\n",
1.71 + __FUNCTION__, sent, remaining );
1.72 + }
1.73 + else
1.74 + {
1.75 + g_print( "[%s]\t\tsent %d, which is NOT equals to requested size = %d\n\n",
1.76 + __FUNCTION__, sent, remaining );
1.77 + goto cleanup;
1.78 +
1.79 + }
1.80 } else {
1.81 break;
1.82 //goto cleanup;
1.83 @@ -957,11 +958,9 @@
1.84 count_bytes += bytes_read;
1.85 remaining -= bytes_read;
1.86 g_print( "[%s] Reading buffer (bytes read = %d, remaining = %d)\n", __FUNCTION__, bytes_read, remaining );
1.87 - /*
1.88 - if ( remaining == 0 ) {
1.89 + if ( remaining == 0 )
1.90 break;
1.91 - }
1.92 - */
1.93 +
1.94 } else {
1.95 break;
1.96 }
1.97 @@ -980,14 +979,14 @@
1.98 }
1.99
1.100 /* verify if the input (read) buffer is ready to receive data */
1.101 - io_cond = g_io_channel_get_buffer_condition( io_channel );
1.102 + //io_cond = g_io_channel_get_buffer_condition( io_channel );
1.103
1.104 g_print( "[%s]\t io_cond %s prepared for reading! (G_IO_IN) !!!\n\n", __FUNCTION__,
1.105 ( ( io_cond & G_IO_IN ) != 0 ) ? "IS" : "IS NOT" );
1.106
1.107 } while ( remaining > 0 );//&& ( io_status == G_IO_STATUS_NORMAL ) );
1.108
1.109 - io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
1.110 + //io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
1.111 if ( remaining == 0 )//( io_cond_control & G_IO_IN ) != 0 )
1.112 {
1.113 response = TRUE;
1.114 @@ -996,7 +995,7 @@
1.115
1.116 } // while
1.117
1.118 - io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
1.119 + //io_cond_control = g_io_channel_get_buffer_condition( io_channel_control );
1.120
1.121 if ( ( ( io_cond_control & G_IO_IN ) != 0 ) /*&&
1.122 ( response || ( recv == size ) ) )
1.123 @@ -1015,8 +1014,8 @@
1.124 }
1.125
1.126 cleanup:
1.127 - //g_static_mutex_unlock (&mutex);
1.128 - g_io_channel_flush( io_channel_control, NULL );
1.129 + g_static_mutex_unlock (&mutex);
1.130 + //g_io_channel_flush( io_channel_control, NULL );
1.131
1.132 if ( trash != NULL )
1.133 g_free( trash );