[svn r772] * Corrected identation; trunk
authormorphbr
Mon Jul 02 08:33:58 2007 +0100 (2007-07-02)
branchtrunk
changeset 766f1da4fbe667e
parent 765 57f3de326cd8
child 767 372e7c8135b9
[svn r772] * Corrected identation;
* Corrected connect with timeout while retrieving channel_list
gmyth/src/gmyth_epg.c
gmyth/src/gmyth_query.c
gmyth/src/gmyth_scheduler.c
gmyth/tests/gmyth_test_http.c
     1.1 --- a/gmyth/src/gmyth_epg.c	Sat Jun 30 15:05:50 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_epg.c	Mon Jul 02 08:33:58 2007 +0100
     1.3 @@ -39,6 +39,8 @@
     1.4  #include "gmyth_file_transfer.h"
     1.5  #include "gmyth_debug.h"
     1.6  
     1.7 +#define CONNECT_TIMEOUT 4
     1.8 +
     1.9  static void     gmyth_epg_class_init(GMythEPGClass * klass);
    1.10  static void     gmyth_epg_init(GMythEPG * object);
    1.11  
    1.12 @@ -96,7 +98,7 @@
    1.13  
    1.14  /** Connects to the Mysql database in the backend. The backend address
    1.15   * is loaded from the GMythSettings instance.
    1.16 - * 
    1.17 + *
    1.18   * @param gmyth_epg the GMythEPG instance to be connected.
    1.19   * @return true if connection was success, false if failed.
    1.20   */
    1.21 @@ -110,7 +112,8 @@
    1.22          gmyth_epg->sqlquery = gmyth_query_new();
    1.23      }
    1.24  
    1.25 -    if (!gmyth_query_connect(gmyth_epg->sqlquery, backend_info)) {
    1.26 +    if (!gmyth_query_connect_with_timeout(gmyth_epg->sqlquery,
    1.27 +                                          backend_info, CONNECT_TIMEOUT)) {
    1.28          gmyth_debug("[%s] Error while connecting to db", __FUNCTION__);
    1.29          return FALSE;
    1.30      }
    1.31 @@ -122,7 +125,7 @@
    1.32  }
    1.33  
    1.34  /** Disconnects from the Mysql database in the backend.
    1.35 - * 
    1.36 + *
    1.37   * @param gmyth_epg the GMythEPG instance to be disconnected
    1.38   * @return true if disconnection was success, false if failed.
    1.39   */
    1.40 @@ -387,7 +390,7 @@
    1.41                             GMythChannelInfo * channel_info, guint8 ** data,
    1.42                             guint * length)
    1.43  {
    1.44 -    gboolean        res = FALSE;
    1.45 +    gboolean res = FALSE;
    1.46  
    1.47      g_return_val_if_fail(gmyth_epg != NULL, FALSE);
    1.48      g_return_val_if_fail(channel_info != NULL, FALSE);
    1.49 @@ -395,9 +398,10 @@
    1.50      if (gmyth_epg_channel_has_icon(gmyth_epg, channel_info)) {
    1.51          GMythFileTransfer *transfer =
    1.52              gmyth_file_transfer_new(gmyth_epg->backend_info);
    1.53 +
    1.54          GMythFileReadResult gmyth_res;
    1.55 -        GByteArray     *icon_data;
    1.56 -        guint64         icon_length = 0;
    1.57 +        GByteArray *icon_data;
    1.58 +        guint64 icon_length = 0;
    1.59  
    1.60          res = gmyth_file_transfer_open(transfer,
    1.61                                         channel_info->channel_icon->str);
     2.1 --- a/gmyth/src/gmyth_query.c	Sat Jun 30 15:05:50 2007 +0100
     2.2 +++ b/gmyth/src/gmyth_query.c	Mon Jul 02 08:33:58 2007 +0100
     2.3 @@ -95,7 +95,7 @@
     2.4  }
     2.5  
     2.6  /** Creates a new instance of GMythQuery.
     2.7 - * 
     2.8 + *
     2.9   * @return a new instance of GMythQuery.
    2.10   */
    2.11  GMythQuery     *
    2.12 @@ -114,14 +114,13 @@
    2.13  {
    2.14      assert(gmyth_query);
    2.15  
    2.16 -    if (gmyth_query->conn == NULL) {
    2.17 +    if (gmyth_query->conn == NULL)
    2.18          gmyth_query->conn = mysql_init(NULL);
    2.19 -    }
    2.20  
    2.21      if (timeout != 0) {
    2.22 -        /*
    2.23 -         * sets connection timeout 
    2.24 -         */
    2.25 +      /*
    2.26 +       * sets connection timeout
    2.27 +       */
    2.28          mysql_options(gmyth_query->conn, MYSQL_OPT_CONNECT_TIMEOUT,
    2.29                        (gchar *) & timeout);
    2.30      }
    2.31 @@ -131,7 +130,7 @@
    2.32  
    2.33  /** Connects to the Mysql database in the backend. The backend address
    2.34   * is loaded from the GMythBackendInfo instance.
    2.35 - * 
    2.36 + *
    2.37   * @param gmyth_query the GMythEPG instance to be connected.
    2.38   * @return true if connection was success, false if failed.
    2.39   */
    2.40 @@ -156,7 +155,7 @@
    2.41      }
    2.42  
    2.43      /*
    2.44 -     * connect to server 
    2.45 +     * connect to server
    2.46       */
    2.47      if (mysql_real_connect(gmyth_query->conn,
    2.48                             gmyth_query->backend_info->hostname,
    2.49 @@ -229,7 +228,7 @@
    2.50   * @param stmt_str the query text.
    2.51   * @return the MYSQL_RES result pointer or NULL if any error happens.
    2.52   */
    2.53 -MYSQL_RES      *
    2.54 +MYSQL_RES*
    2.55  gmyth_query_process_statement(GMythQuery * gmyth_query, char *stmt_str)
    2.56  {
    2.57      assert(gmyth_query);
    2.58 @@ -239,22 +238,18 @@
    2.59      if (gmyth_query == NULL)
    2.60          return NULL;
    2.61  
    2.62 -    /*
    2.63 -     * the statement failed 
    2.64 -     */
    2.65 +    //the statement failed
    2.66      if (mysql_query(gmyth_query->conn, stmt_str) != 0) {
    2.67          gmyth_query_print_error(gmyth_query->conn,
    2.68                                  "Could not execute statement");
    2.69          return NULL;
    2.70      }
    2.71  
    2.72 -    /*
    2.73 -     * the statement succeeded; determine whether it returned data 
    2.74 -     */
    2.75 +    //the statement succeeded; determine whether it returned data
    2.76      return mysql_store_result(gmyth_query->conn);
    2.77  }
    2.78  
    2.79 -MYSQL_RES      *
    2.80 +MYSQL_RES*
    2.81  gmyth_query_process_statement_with_increment(GMythQuery * gmyth_query,
    2.82                                               char *stmt_str, gulong * id)
    2.83  {
    2.84 @@ -266,7 +261,7 @@
    2.85          return NULL;
    2.86  
    2.87      /*
    2.88 -     * the statement failed 
    2.89 +     * the statement failed
    2.90       */
    2.91      if (mysql_query(gmyth_query->conn, stmt_str) != 0) {
    2.92          gmyth_query_print_error(gmyth_query->conn,
     3.1 --- a/gmyth/src/gmyth_scheduler.c	Sat Jun 30 15:05:50 2007 +0100
     3.2 +++ b/gmyth/src/gmyth_scheduler.c	Mon Jul 02 08:33:58 2007 +0100
     3.3 @@ -152,7 +152,7 @@
     3.4  
     3.5  /** Connects to the Mysql database in the backend. The backend address
     3.6   * is loaded from the GMythSettings instance.
     3.7 - * 
     3.8 + *
     3.9   * @param scheduler the GMythScheduler instance to be connected.
    3.10   * @return true if connection was success, false if failed.
    3.11   */
    3.12 @@ -185,7 +185,7 @@
    3.13  }
    3.14  
    3.15  /** Disconnects from the Mysql database in the backend.
    3.16 - * 
    3.17 + *
    3.18   * @param scheduler the GMythScheduler instance to be disconnected
    3.19   * @return true if disconnection was success, false if failed.
    3.20   */
     4.1 --- a/gmyth/tests/gmyth_test_http.c	Sat Jun 30 15:05:50 2007 +0100
     4.2 +++ b/gmyth/tests/gmyth_test_http.c	Mon Jul 02 08:33:58 2007 +0100
     4.3 @@ -13,7 +13,7 @@
     4.4  
     4.5      backend_info = gmyth_backend_info_new();
     4.6  
     4.7 -    gmyth_backend_info_set_hostname(backend_info, "192.168.3.165");
     4.8 +    gmyth_backend_info_set_hostname(backend_info, "192.168.1.118");
     4.9      gmyth_backend_info_set_port(backend_info, 6543);
    4.10      gmyth_backend_info_set_status_port(backend_info, 6544);
    4.11  
    4.12 @@ -32,13 +32,13 @@
    4.13       * 
    4.14       * if ( NULL == epg.channelList || g_slist_length( epg.channelList )
    4.15       * <= 0 ) printf( "Channel list is empty!!!" );
    4.16 -     * 
    4.17 -     * GMythRecorded recorded; recorded =
    4.18 -     * gmyth_http_retrieve_recorded(backend_info);
    4.19 -     * 
    4.20 -     * GMythRecorded_Program* program = recorded.programList->data; 
    4.21 -     */
    4.22 -    GMythRecProfile *profile;
    4.23 +     */ 
    4.24 +    GMythRecorded recorded; 
    4.25 +    recorded = gmyth_http_retrieve_recorded(backend_info);
    4.26 +    
    4.27 +    GMythRecorded_Program* program = recorded.programList->data; 
    4.28 +    
    4.29 +    /*GMythRecProfile *profile;
    4.30  
    4.31      GSList         *profiles =
    4.32          gmyth_http_retrieve_rec_profiles(backend_info, "Transcoders");
    4.33 @@ -66,7 +66,7 @@
    4.34      gint            ret =
    4.35          gmyth_http_retrieve_job_status(backend_info, 1000, start);
    4.36      printf("Status: %d\n\n", ret);
    4.37 -
    4.38 +    */
    4.39      // if ( profile != NULL )
    4.40      // g_object_unref( profile );
    4.41