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
d7df3f96
Commit
d7df3f96
authored
Jun 25, 2018
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: do not use juju/errors on read/write
parent
f0b4eda9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
change_log.md
change_log.md
+4
-0
conn.go
conn.go
+13
-7
version.go
version.go
+3
-3
No files found.
change_log.md
View file @
d7df3f96
...
...
@@ -14,6 +14,10 @@
## develop history ##
---
-
2018/06/25
> buf fix
*
delete juju/errors on read/write in case of network i/o timeout
-
2018/03/29
> improvement
*
use juju/errors instead of pkg/errors
...
...
conn.go
View file @
d7df3f96
...
...
@@ -29,7 +29,7 @@ import (
)
var
(
launchTime
time
.
Time
=
time
.
Now
()
launchTime
=
time
.
Now
()
// ErrInvalidConnection = errors.New("connection has been closed.")
)
...
...
@@ -249,7 +249,8 @@ func (t *gettyTCPConn) read(p []byte) (int, error) {
length
,
err
=
t
.
reader
.
Read
(
p
)
log
.
Debug
(
"now:%s, length:%d, err:%s"
,
currentTime
,
length
,
err
)
atomic
.
AddUint32
(
&
t
.
readBytes
,
uint32
(
length
))
return
length
,
jerrors
.
Trace
(
err
)
//return length, jerrors.Trace(err)
return
length
,
err
}
// tcp connection write
...
...
@@ -282,7 +283,8 @@ func (t *gettyTCPConn) Write(pkg interface{}) (int, error) {
atomic
.
AddUint32
(
&
t
.
writeBytes
,
(
uint32
)(
len
(
p
)))
}
log
.
Debug
(
"now:%s, length:%d, err:%s"
,
currentTime
,
length
,
err
)
return
length
,
jerrors
.
Trace
(
err
)
//return length, jerrors.Trace(err)
return
length
,
err
}
// close tcp connection
...
...
@@ -400,7 +402,8 @@ func (u *gettyUDPConn) read(p []byte) (int, *net.UDPAddr, error) {
atomic
.
AddUint32
(
&
u
.
readBytes
,
uint32
(
length
))
}
return
length
,
addr
,
jerrors
.
Trace
(
err
)
return
length
,
addr
,
err
// return length, addr, jerrors.Trace(err)
}
// write udp packet, @ctx should be of type UDPContext
...
...
@@ -446,7 +449,8 @@ func (u *gettyUDPConn) Write(udpCtx interface{}) (int, error) {
}
log
.
Debug
(
"WriteMsgUDP(peerAddr:%s) = {length:%d, error:%s}"
,
peerAddr
,
length
,
err
)
return
length
,
jerrors
.
Trace
(
err
)
// return length, jerrors.Trace(err)
return
length
,
err
}
// close udp connection
...
...
@@ -543,7 +547,8 @@ func (w *gettyWSConn) read() ([]byte, error) {
}
}
return
b
,
jerrors
.
Trace
(
e
)
// return b, jerrors.Trace(e)
return
b
,
e
}
func
(
w
*
gettyWSConn
)
updateWriteDeadline
()
error
{
...
...
@@ -584,7 +589,8 @@ func (w *gettyWSConn) Write(pkg interface{}) (int, error) {
if
err
=
w
.
conn
.
WriteMessage
(
websocket
.
BinaryMessage
,
p
);
err
==
nil
{
atomic
.
AddUint32
(
&
w
.
writeBytes
,
(
uint32
)(
len
(
p
)))
}
return
len
(
p
),
jerrors
.
Trace
(
err
)
// return len(p), jerrors.Trace(err)
return
len
(
p
),
err
}
func
(
w
*
gettyWSConn
)
writePing
()
error
{
...
...
version.go
View file @
d7df3f96
...
...
@@ -10,9 +10,9 @@
package
getty
const
(
Version
=
"0.8.
3
"
DATE
=
"2018/0
3/18
"
Version
=
"0.8.
4
"
DATE
=
"2018/0
6/25
"
GETTY_MAJOR
=
0
GETTY_MINOR
=
8
GETTY_BUILD
=
3
GETTY_BUILD
=
5
)
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