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
d711a4ba
Commit
d711a4ba
authored
Aug 10, 2021
by
dongjianhui03
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(*): revert 17b08d to fix timeout error
parent
5b7d8d26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
connection.go
connection.go
+14
-14
No files found.
connection.go
View file @
d711a4ba
...
...
@@ -54,10 +54,10 @@ type gettyConn struct {
active
uatomic
.
Int64
// last active, in milliseconds
rTimeout
time
.
Duration
// network current limiting
wTimeout
time
.
Duration
rLastDeadline
int64
// laste
st network read time
wLastDeadline
int64
// laste
st network write time
local
string
// local address
peer
string
// peer address
rLastDeadline
time
.
Time
// la
st network read time
wLastDeadline
time
.
Time
// la
st network write time
local
string
// local address
peer
string
// peer address
ss
Session
}
...
...
@@ -241,12 +241,12 @@ func (t *gettyTCPConn) recv(p []byte) (int, error) {
// of the last read deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime
=
time
.
Now
()
if
currentTime
.
Unix
()
-
t
.
rLastDeadline
>
int64
(
t
.
rTimeout
>>
2
)
{
if
currentTime
.
Sub
(
t
.
rLastDeadline
)
>
t
.
rTimeout
>>
2
{
if
err
=
t
.
conn
.
SetReadDeadline
(
currentTime
.
Add
(
t
.
rTimeout
));
err
!=
nil
{
// just a timeout error
return
0
,
perrors
.
WithStack
(
err
)
}
t
.
rLastDeadline
=
currentTime
.
Unix
()
t
.
rLastDeadline
=
currentTime
}
}
...
...
@@ -271,11 +271,11 @@ func (t *gettyTCPConn) send(pkg interface{}) (int, error) {
// of the last write deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime
=
time
.
Now
()
if
currentTime
.
Unix
()
-
t
.
wLastDeadline
>
int64
(
t
.
wTimeout
>>
2
)
{
if
currentTime
.
Sub
(
t
.
wLastDeadline
)
>
t
.
wTimeout
>>
2
{
if
err
=
t
.
conn
.
SetWriteDeadline
(
currentTime
.
Add
(
t
.
wTimeout
));
err
!=
nil
{
return
0
,
perrors
.
WithStack
(
err
)
}
t
.
wLastDeadline
=
currentTime
.
Unix
()
t
.
wLastDeadline
=
currentTime
}
}
...
...
@@ -392,11 +392,11 @@ func (u *gettyUDPConn) recv(p []byte) (int, *net.UDPAddr, error) {
// of the last read deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime
:=
time
.
Now
()
if
currentTime
.
Unix
()
-
u
.
rLastDeadline
>
int64
(
u
.
rTimeout
>>
2
)
{
if
currentTime
.
Sub
(
u
.
rLastDeadline
)
>
u
.
rTimeout
>>
2
{
if
err
:=
u
.
conn
.
SetReadDeadline
(
currentTime
.
Add
(
u
.
rTimeout
));
err
!=
nil
{
return
0
,
nil
,
perrors
.
WithStack
(
err
)
}
u
.
rLastDeadline
=
currentTime
.
Unix
()
u
.
rLastDeadline
=
currentTime
}
}
...
...
@@ -439,11 +439,11 @@ func (u *gettyUDPConn) send(udpCtx interface{}) (int, error) {
// of the last write deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime
=
time
.
Now
()
if
currentTime
.
Unix
()
-
u
.
wLastDeadline
>
int64
(
u
.
wTimeout
>>
2
)
{
if
currentTime
.
Sub
(
u
.
wLastDeadline
)
>
u
.
wTimeout
>>
2
{
if
err
=
u
.
conn
.
SetWriteDeadline
(
currentTime
.
Add
(
u
.
wTimeout
));
err
!=
nil
{
return
0
,
perrors
.
WithStack
(
err
)
}
u
.
wLastDeadline
=
currentTime
.
Unix
()
u
.
wLastDeadline
=
currentTime
}
}
...
...
@@ -564,11 +564,11 @@ func (w *gettyWSConn) updateWriteDeadline() error {
// of the last write deadline exceeded.
// See https://github.com/golang/go/issues/15133 for details.
currentTime
=
time
.
Now
()
if
currentTime
.
Unix
()
-
w
.
wLastDeadline
>
int64
(
w
.
wTimeout
>>
2
)
{
if
currentTime
.
Sub
(
w
.
wLastDeadline
)
>
w
.
wTimeout
>>
2
{
if
err
=
w
.
conn
.
SetWriteDeadline
(
currentTime
.
Add
(
w
.
wTimeout
));
err
!=
nil
{
return
perrors
.
WithStack
(
err
)
}
w
.
wLastDeadline
=
currentTime
.
Unix
()
w
.
wLastDeadline
=
currentTime
}
}
...
...
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