public
Description: Pure Ruby implementation of an SFTP (protocols 1-6) client
Homepage: http://rubyforge.org/projects/net-ssh
Clone URL: git://github.com/jamis/net-sftp.git
add #abort! method to force stop upload/download operations
jamis (author)
Thu Apr 24 08:52:34 -0700 2008
commit  f2b76f20460cff435f8726ec2883b9fac668cbff
tree    be4f005b5b356af91dc76eceaafead35132321ce
parent  3407e96653590c61809449a560b0c3ff9e398ef0
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 === *unreleased*
0
 
0
+* Add #abort! method to Upload and Download operations [Jamis Buck]
0
+
0
 * More complete support for file-type detection in protocol versions 1-3 [Jamis Buck]
0
 
0
 
...
170
171
172
 
 
 
 
 
 
173
174
175
...
170
171
172
173
174
175
176
177
178
179
180
181
0
@@ -170,6 +170,12 @@ module Net; module SFTP; module Operations
0
       @active > 0 || stack.any?
0
     end
0
 
0
+ # Forces the transfer to stop.
0
+ def abort!
0
+ @active = 0
0
+ @stack.clear
0
+ end
0
+
0
     # Runs the SSH event loop for as long as the downloader is active (see
0
     # #active?). This can be used to block until the download completes.
0
     def wait
...
183
184
185
 
 
 
 
 
 
 
186
187
188
...
183
184
185
186
187
188
189
190
191
192
193
194
195
0
@@ -183,6 +183,13 @@ module Net; module SFTP; module Operations
0
       @active > 0 || @stack.any?
0
     end
0
 
0
+ # Forces the transfer to stop.
0
+ def abort!
0
+ @active = 0
0
+ @stack.clear
0
+ @uploads.clear
0
+ end
0
+
0
     # Blocks until the upload has completed.
0
     def wait
0
       sftp.loop { active? }

Comments

    No one has commented yet.