Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
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
wei.xuan
getty
Commits
ddb95afc
Commit
ddb95afc
authored
Oct 13, 2016
by
alexstocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update conn.go:gettyWSConn{websocket.Conn} -> conn.go:gettyWSConn{*websocket.Conn}
parent
0e2aa36b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
conn.go
conn.go
+6
-9
dev.list
dev.list
+3
-1
server.go
server.go
+0
-1
No files found.
conn.go
View file @
ddb95afc
...
...
@@ -17,20 +17,16 @@ import (
)
import
(
log
"github.com/AlexStocks/log4go"
//
log "github.com/AlexStocks/log4go"
"github.com/gorilla/websocket"
)
var
(
launchTime
time
.
Time
launchTime
time
.
Time
=
time
.
Now
()
// ErrInvalidConnection = errors.New("connection has been closed.")
)
func
init
()
{
launchTime
=
time
.
Now
()
}
/////////////////////////////////////////
// connection interfacke
/////////////////////////////////////////
...
...
@@ -41,6 +37,8 @@ type iConn interface {
UpdateActive
()
GetActive
()
time
.
Time
write
(
p
[]
byte
)
error
// don't distinguish between tcp connection and websocket connection. Because
// gorilla/websocket/conn.go:(Conn)Close also invoke net.Conn.Close
close
(
int
)
}
...
...
@@ -161,7 +159,7 @@ func (this *gettyTCPConn) close(waitSec int) {
type
gettyWSConn
struct
{
gettyConn
conn
websocket
.
Conn
conn
*
websocket
.
Conn
}
// create websocket connection
...
...
@@ -179,7 +177,7 @@ func newGettyWSConn(conn *websocket.Conn) *gettyWSConn {
}
gettyWSConn
:=
&
gettyWSConn
{
conn
:
*
conn
,
conn
:
conn
,
gettyConn
:
gettyConn
{
ID
:
atomic
.
AddUint32
(
&
connID
,
1
),
local
:
localAddr
,
...
...
@@ -192,7 +190,6 @@ func newGettyWSConn(conn *websocket.Conn) *gettyWSConn {
}
func
(
this
*
gettyWSConn
)
handlePong
(
string
)
error
{
log
.
Debug
(
"get pong package"
)
this
.
UpdateActive
()
return
nil
}
...
...
dev.list
View file @
ddb95afc
...
...
@@ -20,7 +20,9 @@
>
> 4 add conn.go:(gettyConn)GetActive, which can used as (Session)GetActive
>
> 5 version: 0.4.03
> 5 modify conn.go:gettyWSConn{websocket.Conn} -> conn.go:gettyWSConn{*websocket.Conn}
>
> 6 version: 0.4.03
- 2016/10/11
> 1 fix bug: use websocket.BinaryMessage in conn.go:(gettyWSConn)write
...
...
server.go
View file @
ddb95afc
...
...
@@ -147,7 +147,6 @@ func newWSHandler(server *Server, newSession NewSessionCallback) *wsHandler {
}
func
(
this
*
wsHandler
)
serveWSRequest
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
log
.
Debug
(
"get client request:%#v"
,
r
)
if
r
.
Method
!=
"GET"
{
// w.WriteHeader(http.StatusMethodNotAllowed)
http
.
Error
(
w
,
"Method not allowed"
,
405
)
...
...
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