Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
30437dce
Commit
30437dce
authored
Jul 24, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改支持重连
parent
a5c621f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
server.go
pkg/httpd/server.go
+6
-1
No files found.
pkg/httpd/server.go
View file @
30437dce
package
httpd
import
(
"context"
"net"
"net/http"
"path/filepath"
...
...
@@ -16,7 +17,7 @@ import (
var
(
httpServer
*
http
.
Server
Timeout
=
time
.
Duration
(
6
0
)
Timeout
=
time
.
Duration
(
1
0
)
)
var
upgrader
=
gorilla
.
Upgrader
(
gorillaws
.
Upgrader
{
...
...
@@ -69,6 +70,10 @@ func StartHTTPServer() {
}
sshWs
.
OnConnect
=
func
(
c
*
neffos
.
Conn
)
error
{
if
c
.
WasReconnected
()
{
namespace
:=
c
.
Socket
()
.
Request
()
.
Header
.
Get
(
"X-Namespace"
)
if
namespace
!=
""
{
_
,
_
=
c
.
Connect
(
context
.
TODO
(),
"ssh"
)
}
logger
.
Debugf
(
"Connection %s reconnected, with tries: %d"
,
c
.
ID
(),
c
.
ReconnectTries
)
}
else
{
logger
.
Debug
(
"A new ws connection arrive"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment