[svn r364] Fixed a mutual exclusion bug on the Monitor Handler GIOChannel read callback.
1 #include <glib-object.h>
5 main (int args, const char **argv)
7 const char *uri = argv[1];
8 GMythURI *gmyth_uri = NULL;
10 GMythBackendInfo *backend_info;
14 backend_info = gmyth_backend_info_new ();
15 gmyth_uri = gmyth_uri_new_with_value (uri);
17 gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (gmyth_uri));
18 gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port (gmyth_uri));
20 res = gmyth_util_file_exists (backend_info, uri);
22 g_debug ("file not exists");
25 GMythFileTransfer *file_transfer = gmyth_file_transfer_new ();
26 GString *hostname = g_string_new (uri);
27 res = gmyth_file_transfer_open (file_transfer, hostname);
29 g_debug ("Fail to open server");
33 guint64 filesize = gmyth_file_transfer_get_filesize (file_transfer);
35 g_debug ("filesize is 0");
39 GByteArray *data = g_byte_array_new ();
40 guint num = gmyth_file_transfer_read (file_transfer, data, filesize, FALSE);
41 g_debug ("read %d bytes", num);
43 g_byte_array_free (data, TRUE);
44 g_object_unref (file_transfer);
45 g_object_unref (gmyth_uri);
46 g_string_free (hostname, TRUE);