Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request #341: add a keepalive configuration for both FTP and SCP #465

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ The `.remote-sync.json` in your project root will use these options:
| `source` | String | "" | Source directory relative to project root |
| `ignore` | Array | [".remote-sync.json",".git/**"] | Array of [minimatch](https://github.com/isaacs/minimatch) patterns of files to ignore |
| `watch` | Array | [] | Array of files (relative to project root - starting with "/") to watch for changes |
| `keepalive` | Integer | 0 | Number of seconds to wait between two keepalive |
| `uploadMirrors` | Array | [] | Transport mirror config array when upload |
| `uploadOnSave` | Boolean | false | Whether or not to upload the current file when saved |
| `saveOnUpload` | Boolean | false | Whether or not to save a modified file before uploading |
Expand Down Expand Up @@ -122,7 +123,8 @@ The `.remote-sync.json` in your project root will use these options:
"watch":[
"/css/styles.css",
"/index.html"
]
],
"keepalive": 60
}
```

Expand Down Expand Up @@ -164,7 +166,8 @@ The `.remote-sync.json` in your project root will use these options:
"watch":[
"/css/styles.css",
"/index.html"
]
],
"keepalive": 60
}
```

Expand Down
3 changes: 2 additions & 1 deletion lib/transports/FtpTransport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class FtpTransport
directory(targetPath)

_getConnection: (callback) ->
{hostname, port, username, password, secure} = @settings
{hostname, port, username, password, secure, keepalive} = @settings

if @connection
return callback null, @connection
Expand Down Expand Up @@ -144,5 +144,6 @@ class FtpTransport
user: username
password: password
secure: secure
keepalive: keepalive * 1000 || 0

@connection = connection
3 changes: 2 additions & 1 deletion lib/transports/ScpTransport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ScpTransport
callback null, files

_getConnection: (callback) ->
{hostname, port, username, password, keyfile, useAgent, passphrase, readyTimeout} = @settings
{hostname, port, username, password, keyfile, useAgent, passphrase, readyTimeout, keepalive} = @settings

if @connection
return callback null, @connection
Expand Down Expand Up @@ -185,5 +185,6 @@ class ScpTransport
passphrase: passphrase
readyTimeout: readyTimeout
agent: agent
keepaliveInterval: keepalive * 1000 || 0

@connection = connection
5 changes: 5 additions & 0 deletions lib/view/host-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class ConfigView extends View
@div class: 'block', outlet: 'ftpPasswordBlock', style: 'display:none', =>
@label 'Password'

@label 'Keepalive'
@subview 'keepalive', new TextEditorView(mini: true, placeholderText: "Interval to send keepalive requests in seconds. Leave blank to disable")

@label 'Watch automatically'
@subview 'watch', new TextEditorView(mini: true, placeholderText: "Files that will be automatically watched on project open")

Expand Down Expand Up @@ -134,5 +137,7 @@ class ConfigView extends View
else
@host.useAgent = undefined

@host.keepalive = parseInt(@host.keepalive) || 0

@host.saveJSON()
@close()