Skip to content

Commit

Permalink
implemented QUIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Bronkhorst committed Apr 17, 2012
1 parent 3c21b46 commit d54a37f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/em-ftp-client/control_connection.rb
Expand Up @@ -171,6 +171,14 @@ def stor(filename)
@responder = :stor_response
end

def close
if @data_connection
raise "Can not close connection while data connection is still open"
end
send_data("QUIT\r\n")
@responder = :close_response
end

def list
send_data("LIST\r\n")
@responder = :list_response
Expand Down Expand Up @@ -288,7 +296,10 @@ def list_response(response=nil)
call_callback(file_list)
end
end


def close_response(response=nil)
close_connection
end
end
end
end
7 changes: 7 additions & 0 deletions lib/em-ftp-client/session.rb
Expand Up @@ -57,6 +57,13 @@ def put(file, &cb)
end
control_connection.pasv
end

def close
@control_connection.callback do
yield if block_given?
end
@control_connection.close
end
end
end
end
Expand Down

0 comments on commit d54a37f

Please sign in to comment.