Destroy the file tranfer session with timeout.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 15 Mar 2004 19:11:20 +0000 (19:11 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 15 Mar 2004 19:11:20 +0000 (19:11 +0000)
CHANGES
lib/silcclient/client_ftp.c
lib/silcsftp/sftp_server.c

diff --git a/CHANGES b/CHANGES
index fac02d84abf0e666c31464138fc7e1680939e47d..06fe0ee8a26a7a67421f2915760c53c0a7e00a74 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,11 @@
+Mon Mar 15 21:10:08 EET 2004  Pekka Riikonen <priikone@silcnet.org>
+
+       * Destroy the file transfer session in silc_client_file_close
+         with timeout.  Affected file lib/silcclient/client_ftp.c.
+
+       * Call SFTP server monitor in READ and WRITE after the actual
+         operations.  Affected file lib/silcsftp/sftp_server.c.
+
 Wed Mar 10 21:30:02 EET 2004  Pekka Riikonen <priikone@silcnet.org>
 
        * Create one configure script from configure fragments
index 42b987ca9a6798934960c7ebe63f964051f0e643..3e71b5ab07eb55ee11754aacfc84fddd5adb1a3e 100644 (file)
@@ -1040,6 +1040,11 @@ silc_client_file_receive(SilcClient client,
   return SILC_CLIENT_FILE_OK;
 }
 
+SILC_TASK_CALLBACK(silc_client_file_close_final)
+{
+  silc_client_ftp_session_free(context);
+}
+
 /* Closes file transmission session indicated by the `session_id'.
    If file transmission is being conducted it will be aborted
    automatically. This function is also used to close the session
@@ -1076,7 +1081,10 @@ SilcClientFileError silc_client_file_close(SilcClient client,
                        session->client_entry, session->session_id,
                        session->filepath, session->monitor_context);
 
-  silc_client_ftp_session_free(session);
+  /* Destroy via timeout */
+  silc_schedule_task_add(session->client->schedule, 0,
+                        silc_client_file_close_final, session,
+                        0, 1, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
 
   return SILC_CLIENT_FILE_OK;
 }
index f23d1e8604fb6c0efc31c0b06782bc31597cc96c..cbfbe43c2ca63ca5ddeaef931c33de5cf75f2e07 100644 (file)
@@ -480,6 +480,11 @@ void silc_sftp_server_receive_process(SilcSFTP sftp,
        break;
       }
 
+      /* Read operation */
+      server->fs->fs->sftp_read(server->fs->fs_context, sftp,
+                               handle, offset, len,
+                               silc_sftp_server_data, SILC_32_TO_PTR(id));
+
       /* Call monitor */
       if (server->monitors & SILC_SFTP_MONITOR_READ && server->monitor) {
        mdata.offset = offset;
@@ -487,11 +492,6 @@ void silc_sftp_server_receive_process(SilcSFTP sftp,
        (*server->monitor)(sftp, SILC_SFTP_MONITOR_READ, &mdata,
                           server->monitor_context);
       }
-
-      /* Read operation */
-      server->fs->fs->sftp_read(server->fs->fs_context, sftp,
-                               handle, offset, len,
-                               silc_sftp_server_data, SILC_32_TO_PTR(id));
     }
     break;
 
@@ -525,6 +525,11 @@ void silc_sftp_server_receive_process(SilcSFTP sftp,
        break;
       }
 
+      /* Write operation */
+      server->fs->fs->sftp_write(server->fs->fs_context, sftp, handle, offset,
+                                (const unsigned char *)data, data_len,
+                                silc_sftp_server_status, SILC_32_TO_PTR(id));
+
       /* Call monitor */
       if (server->monitors & SILC_SFTP_MONITOR_WRITE && server->monitor) {
        mdata.offset = offset;
@@ -532,11 +537,6 @@ void silc_sftp_server_receive_process(SilcSFTP sftp,
        (*server->monitor)(sftp, SILC_SFTP_MONITOR_WRITE, &mdata,
                           server->monitor_context);
       }
-
-      /* Write operation */
-      server->fs->fs->sftp_write(server->fs->fs_context, sftp, handle, offset,
-                                (const unsigned char *)data, data_len,
-                                silc_sftp_server_status, SILC_32_TO_PTR(id));
     }
     break;