[svn r124] Fixes to the newly added BackendInfo issues. trunk
authorrosfran
Tue Nov 28 00:53:25 2006 +0000 (2006-11-28)
branchtrunk
changeset 123253b9171a703
parent 122 49bf9d28f38a
child 124 d2d5fe1c3997
[svn r124] Fixes to the newly added BackendInfo issues.
gmyth/src/gmyth_backendinfo.c
gmyth/src/gmyth_socket.c
gmyth/src/gmyth_uri.c
gmyth/src/gmyth_uri.h
     1.1 --- a/gmyth/src/gmyth_backendinfo.c	Tue Nov 28 00:15:37 2006 +0000
     1.2 +++ b/gmyth/src/gmyth_backendinfo.c	Tue Nov 28 00:53:25 2006 +0000
     1.3 @@ -113,17 +113,18 @@
     1.4  }
     1.5  
     1.6  GMythBackendInfo*
     1.7 -gmyth_backend_info_new_with_uri (const gchar *uri_str )
     1.8 +gmyth_backend_info_new_with_uri ( const gchar *uri_str )
     1.9  {
    1.10      GMythBackendInfo *backend_info = 
    1.11          GMYTH_BACKEND_INFO (g_object_new(GMYTH_BACKEND_INFO_TYPE, NULL));
    1.12          
    1.13 -    GMythURI* uri = gmyth_uri_new( (gchar*)uri_str );
    1.14 +    GMythURI* uri = gmyth_uri_new( uri_str );
    1.15      
    1.16      gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (uri ) );
    1.17      gmyth_backend_info_set_username (backend_info, gmyth_uri_get_user( uri ) );
    1.18      gmyth_backend_info_set_password (backend_info, gmyth_uri_get_password( uri ) );
    1.19 -    gmyth_backend_info_set_db_name (backend_info, gmyth_uri_get_path( uri ) );
    1.20 +    gmyth_backend_info_set_db_name (backend_info, strlen( gmyth_uri_get_fragment( uri ) ) > 0 
    1.21 +    				? gmyth_uri_get_fragment( uri ) : gmyth_uri_get_query( uri ) );
    1.22      gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( uri ) );
    1.23  
    1.24      return backend_info;
     2.1 --- a/gmyth/src/gmyth_socket.c	Tue Nov 28 00:15:37 2006 +0000
     2.2 +++ b/gmyth/src/gmyth_socket.c	Tue Nov 28 00:53:25 2006 +0000
     2.3 @@ -505,8 +505,8 @@
     2.4  	if ( gmyth_socket->sd < 0 )
     2.5  	    continue;
     2.6  
     2.7 -	g_debug( "[%s] hostname = %s, sock_fd = %d, addr = %s, addr_len = %d, \
     2.8 -		ai_family = %d, ai_protocol = %d\n",
     2.9 +	g_debug( "[%s] hostname = %s, sock_fd = %d, addr = %s, addr_len = %d, "\
    2.10 +		"ai_family = %d, ai_protocol = %d\n",
    2.11  		__FUNCTION__, hostname, gmyth_socket->sd, inet_ntoa( sa->sin_addr ),
    2.12  		addr_info0->ai_addrlen, addr_info0->ai_family, addr_info0->ai_protocol );
    2.13  		
    2.14 @@ -697,7 +697,8 @@
    2.15  	gchar *hostname_backend, int port, gboolean blocking_client)
    2.16  {
    2.17      if (!gmyth_socket_connect (gmyth_socket, hostname_backend, port)) {
    2.18 -		g_warning ("[%s] Could not open socket to backend machine", __FUNCTION__);
    2.19 +		g_warning ("[%s] Could not open socket to backend machine [%s]\n", __FUNCTION__,
    2.20 +					hostname_backend );
    2.21  		return FALSE;
    2.22      }
    2.23  
     3.1 --- a/gmyth/src/gmyth_uri.c	Tue Nov 28 00:15:37 2006 +0000
     3.2 +++ b/gmyth/src/gmyth_uri.c	Tue Nov 28 00:53:25 2006 +0000
     3.3 @@ -80,7 +80,7 @@
     3.4  }
     3.5  
     3.6  const GMythURI *
     3.7 -gmyth_uri_new( gchar *value )
     3.8 +gmyth_uri_new( const gchar *value )
     3.9  {
    3.10  	
    3.11  	GMythURI *uri = gmyth_uri_init();
    3.12 @@ -202,6 +202,10 @@
    3.13  			queryLen -= uriLen - (currIdx+sharpIdx+1);
    3.14  		uri->query = g_string_append_len( uri->query, value+currIdx+questionIdx+1, queryLen );
    3.15  	}
    3.16 +	g_print( "[%s] host = %s, port = %d, path = %s, query = %s, fragment = %s, "\
    3.17 +								"user = %s, password = %s.\n", __FUNCTION__, uri->host->str, uri->port,
    3.18 +													uri->path->str, uri->query->str, uri->fragment->str,
    3.19 +													uri->user->str, uri->password->str );
    3.20  	
    3.21  	return uri;
    3.22  
     4.1 --- a/gmyth/src/gmyth_uri.h	Tue Nov 28 00:15:37 2006 +0000
     4.2 +++ b/gmyth/src/gmyth_uri.h	Tue Nov 28 00:53:25 2006 +0000
     4.3 @@ -53,7 +53,7 @@
     4.4  	GString *query;
     4.5  } GMythURI;
     4.6  
     4.7 -const GMythURI *gmyth_uri_new( gchar *value );
     4.8 +const GMythURI *gmyth_uri_new( const gchar *value );
     4.9  
    4.10  gboolean gmyth_uri_is_equals( GMythURI* uri1, GMythURI* uri2 );
    4.11  
    4.12 @@ -63,5 +63,7 @@
    4.13  #define gmyth_uri_get_path(urip) (urip->path->str)
    4.14  #define gmyth_uri_get_user(urip) (urip->user->str)
    4.15  #define gmyth_uri_get_password(urip) (urip->password->str)
    4.16 +#define gmyth_uri_get_fragment(urip) (urip->fragment->str)
    4.17 +#define gmyth_uri_get_query(urip) (urip->query->str)
    4.18  
    4.19  #endif