Enlightenment CVS committal
Author : chaos
Project : e17
Module : apps/evfs
Dir : e17/apps/evfs/src/plugins
Modified Files:
evfs_fs_bzip2.c evfs_fs_sftp.c
Log Message:
* Slightly more debugging output in sftp, for now. There are issues here
* Handle bzip2 errors more cleanly, and prevent endless loop lockup
===================================================================
RCS file: /cvs/e/e17/apps/evfs/src/plugins/evfs_fs_bzip2.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- evfs_fs_bzip2.c 3 Feb 2006 23:12:13 -0000 1.6
+++ evfs_fs_bzip2.c 28 Mar 2006 07:42:33 -0000 1.7
@@ -56,6 +56,8 @@
void evfs_dir_list(evfs_client * client, evfs_command * file);
#define BZIP2_BUFFER 5000
+#define EVFS_BZ2_GOT_DATA -1
+#define EVFS_BZ2_ERROR -2
Ecore_Hash *bzip_hash;
typedef struct bzip2_file
@@ -150,11 +152,11 @@
if (bfile->stream.avail_in > 0)
{
//printf("No need to read, got data already..\n");
- return 0;
+ return EVFS_BZ2_GOT_DATA;
}
res = evfs_uri_read(client, ref->parent, bfile->buffer, BZIP2_BUFFER);
- //printf("Read %d bytes at bzip2_read from fd %d using filename %s\n", res,
ref->fd, ref->path);
+ /*printf("Read %d bytes at bzip2_read from fd %d using filename %s\n", res,
ref->fd, ref->path);*/
if (res > 0)
{
@@ -162,9 +164,12 @@
bfile->stream.next_in = (char *)bfile->buffer;
bfile->stream.avail_in = res;
}
- else
- {
+ else if (res == 0) {
+ //printf("res 0\n");
+ return 0;
+ } else {
//printf("Res returnde an error: %d\n", res);
+ return EVFS_BZ2_ERROR;
//exit(0);
}
@@ -193,7 +198,10 @@
bz_result = BZ2_bzDecompress(&bfile->stream);
//printf("Avail_out goes to %d\n", bfile->stream.avail_out);
- //printf (" BZ Result is: %d\n", bz_result);
+ //printf (" BZ Result is: %d -> %d\n", bz_result,res);
+
+ if (res == 0)
+ return 0; /*No data left..*/
if (bz_result == -1)
break;
===================================================================
RCS file: /cvs/e/e17/apps/evfs/src/plugins/evfs_fs_sftp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- evfs_fs_sftp.c 26 Feb 2006 04:42:20 -0000 1.10
+++ evfs_fs_sftp.c 28 Mar 2006 07:42:33 -0000 1.11
@@ -562,9 +562,9 @@
handle->sftp_handle= str;
handle->sftp_handle_len = length;
- //printf(" [*] Reading handle with id %d, length %d\n", id, length);
+ printf(" [*] Reading handle with id %d, length %d\n", id, length);
- //printf(" [*] Writing handle to hash (%p) , with id %d\n", handle,
id);
+ printf(" [*] Writing handle to hash (%p) , with id %d\n", handle, id);
ecore_hash_set(conn->handle_hash, (int*)id, handle);
}
@@ -611,10 +611,17 @@
void sftp_handle_status(SftpConnection* conn, char** c) {
int id;
+ int error_code;
+ char* error_message;
+ char* language_tag;
SftpGenericHandle* rhandle;
+ int length;
/*Read the identifier*/
id = read_int32(c);
+ error_code = read_int32(c);
+ error_message = read_string(c, &length);
+ language_tag = read_string(c, &length);
//printf("Got a status for id %d\n", id);
rhandle = ecore_hash_get(conn->id_open_hash, (int*)id);
@@ -622,6 +629,8 @@
//printf("Rhandle is %p\n", rhandle);
if (rhandle) rhandle->status = STATUS_FINISHED;
+ printf("id: %d, error_code: %d, message: '%s', tag: '%s'\n", id,
error_code, error_message, language_tag);
+
ecore_hash_remove(conn->id_open_hash, (int*)id);
}
@@ -718,32 +727,32 @@
switch (sftp_type) {
case SSH2_FXP_HANDLE:
- //printf (" [*] TYPE: HANDLE: %d\n", sftp_type);
+ printf (" [*] TYPE: HANDLE: %d\n", sftp_type);
sftp_read_handle(conn, &c);
break;
case SSH2_FXP_STATUS:
- //printf (" [*] TYPE: STATUS: %d\n",sftp_type);
+ printf (" [*] TYPE: STATUS: %d\n",sftp_type);
sftp_handle_status(conn, &c);
break;
case SSH2_FXP_ATTRS:
- //printf (" [*] Received SSH ATTRIBUTES\n");
+ printf (" [*] Received SSH ATTRIBUTES\n");
sftp_handle_attr(conn, &c);
break;
case SSH2_FXP_VERSION:
- //printf (" [*] TYPE: VERSION: %d\n",sftp_type);
+ printf (" [*] TYPE: VERSION: %d\n",sftp_type);
conn->status = SFTP_CONNECTED;
goto FREE; /*Ignore the reply for now - FIXME*/
break;
case SSH2_FXP_NAME:
- //printf (" [*] TYPE: NAME: %d\n", sftp_type);
+ printf (" [*] TYPE: NAME: %d\n", sftp_type);
sftp_read_names(conn, &c);
break;
case SSH2_FXP_DATA:
- //printf(" [*] TYPE: DATA\n");
+ printf(" [*] TYPE: DATA\n");
sftp_handle_data(conn, &c);
break;
default:
- //printf (" [*] TYPE: UNKNOWN: %d\n", sftp_type);
+ printf (" [*] TYPE: UNKNOWN: %d\n", sftp_type);
/*Out of sync? We have to leave..*/
goto FREE;
break;
@@ -927,6 +936,8 @@
SftpGenericHandle* handle;
SftpOpenHandle* ohandle;
+ printf("SFTP read\n");
+
sftp_split_host_path(file->path, &host, &path);
@@ -969,6 +980,8 @@
printf("Could not find open file handle\n");
}
+ printf("Done\n");
+
}
int
@@ -979,6 +992,8 @@
int rid;
SftpOpenHandle* handle;
+ printf("******************** SFTP open file\n");
+
sftp_split_host_path(file->path, &host, &path);
@@ -987,19 +1002,26 @@
conn = sftp_connect(host);
}
+ printf("Getting connection...\n");
while (conn->status == SFTP_INIT) {
ecore_main_loop_iterate();
usleep(10);
}
+ printf("...got\n");
rid = sftp_file_open(conn, path, 0);
/*Wait till we have a handle*/
/*FIXME - is there a better way of waiting-till-event in ecore?*/
+
+
+ printf("opening file...'%s'\n", file->path);
while (! (handle = ecore_hash_get(conn->handle_hash, (int*)rid))) {
ecore_main_loop_iterate();
usleep(10);
}
+ printf("opened.....\n");
+
file->fd = sftp_open_handle_get_next();
handle->int_id = file->fd;
handle->conn = conn;
@@ -1007,6 +1029,8 @@
free(host);
free(path);
+
+ printf("*********************** Opened\n");
return file->fd;
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs