Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ module.exports =
configFileName:
type: 'string'
default: '.remote-sync.json'
concurrentTransports:
type: 'integer'
default: '1'
description: 'How many transfers in process at the same time'

activate: (state) ->
projectDict = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/UploadListener.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UploadListener
handleAction: (localFilePath, transport, action) ->
if not @queue
async = require "async" if not async
@queue = async.queue(@processFile.bind(@), 1)
@queue = async.queue(@processFile.bind(@), atom.config.get('remote-sync-pro.concurrentTransports'))


if @queue.length()
Expand Down
21 changes: 14 additions & 7 deletions lib/transports/FtpTransport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,24 @@ class FtpTransport
{hostname, port, username, password, secure} = @settings

if @connection
return callback null, @connection

@logger.log "Connecting: #{username}@#{hostname}:#{port}"
connection = @connection
if @isConnected
return callback null, connection
else
connection.on "ready", ->
callback null, connection
return

FtpConnection = require "ftp" if not FtpConnection

connection = new FtpConnection
@connection = connection
@isConnected = false

@logger.log "Connecting: #{username}@#{hostname}:#{port}"
wasReady = false

connection.on "ready", ->
connection.on "ready", =>
@isConnected = true
wasReady = true
callback null, connection

Expand All @@ -136,6 +144,7 @@ class FtpTransport
@connection = null

connection.on "end", =>
@isConnected = false
@connection = null

connection.connect
Expand All @@ -144,5 +153,3 @@ class FtpTransport
user: username
password: password
secure: secure

@connection = connection
21 changes: 14 additions & 7 deletions lib/transports/ScpTransport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,24 @@ class ScpTransport
{hostname, port, username, password, keyfile, useAgent, passphrase, readyTimeout} = @settings

if @connection
return callback null, @connection

@logger.log "Connecting: #{username}@#{hostname}:#{port}"
connection = @connection
if @isConnected
return callback null, connection
else
connection.on "ready", ->
callback null, connection
return

SSHConnection = require "ssh2" if not SSHConnection

connection = new SSHConnection
@connection = connection
@isConnected = false

@logger.log "Connecting: #{username}@#{hostname}:#{port}"
wasReady = false

connection.on "ready", ->
connection.on "ready", =>
@isConnected = true
wasReady = true
callback null, connection

Expand All @@ -153,6 +161,7 @@ class ScpTransport
@connection = null

connection.on "end", =>
@isConnected = false
@connection = null

if keyfile
Expand Down Expand Up @@ -185,5 +194,3 @@ class ScpTransport
passphrase: passphrase
readyTimeout: readyTimeout
agent: agent

@connection = connection