Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Shout
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
developer
SwiftSSH
Shout
Commits
9612c133
Unverified
Commit
9612c133
authored
3 years ago
by
Jake Heiser
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #55 from SimplyKyra/add-connection-timeout
Added a timeout to the SSH init method
parents
fbcae228
53e77049
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/Shout/SSH.swift
+3
-2
3 additions, 2 deletions
Sources/Shout/SSH.swift
with
3 additions
and
2 deletions
Sources/Shout/SSH.swift
+
3
−
2
View file @
9612c133
...
...
@@ -45,13 +45,14 @@ public class SSH {
/// - Parameters:
/// - host: the host to connect to
/// - port: the port to connect to; default 22
/// - timeout: timeout to use (in msec); default 0
/// - Throws: SSHError if the SSH session couldn't be created
public
init
(
host
:
String
,
port
:
Int32
=
22
)
throws
{
public
init
(
host
:
String
,
port
:
Int32
=
22
,
timeout
:
UInt
=
0
)
throws
{
self
.
sock
=
try
Socket
.
create
()
self
.
session
=
try
Session
()
session
.
blocking
=
1
try
sock
.
connect
(
to
:
host
,
port
:
port
)
try
sock
.
connect
(
to
:
host
,
port
:
port
,
timeout
:
timeout
)
try
session
.
handshake
(
over
:
sock
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment