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
3e82e215
Commit
3e82e215
authored
Mar 19, 2018
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
close net.Conn when connected failed
parent
5df04180
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
change_log.md
change_log.md
+1
-0
client.go
client.go
+3
-0
No files found.
change_log.md
View file @
3e82e215
...
...
@@ -20,6 +20,7 @@
*
check udp connection alive after connect()
*
use ReadFromUDP as the uniform UDP read interface
*
close net.UDPConn when connected failed
*
close net.Conn when connected failed
-
2018/03/17
> improvement
...
...
client.go
View file @
3e82e215
...
...
@@ -127,6 +127,7 @@ func (c *client) dialTCP() Session {
}
conn
,
err
=
net
.
DialTimeout
(
"tcp"
,
c
.
addr
,
connectTimeout
)
if
err
==
nil
&&
conn
.
LocalAddr
()
.
String
()
==
conn
.
RemoteAddr
()
.
String
()
{
conn
.
Close
()
err
=
errSelfConnect
}
if
err
==
nil
{
...
...
@@ -207,6 +208,7 @@ func (c *client) dialWS() Session {
conn
,
_
,
err
=
dialer
.
Dial
(
c
.
addr
,
nil
)
log
.
Info
(
"websocket.dialer.Dial(addr:%s) = error:%s"
,
c
.
addr
,
err
)
if
err
==
nil
&&
conn
.
LocalAddr
()
.
String
()
==
conn
.
RemoteAddr
()
.
String
()
{
conn
.
Close
()
err
=
errSelfConnect
}
if
err
==
nil
{
...
...
@@ -283,6 +285,7 @@ func (c *client) dialWSS() Session {
}
conn
,
_
,
err
=
dialer
.
Dial
(
c
.
addr
,
nil
)
if
err
==
nil
&&
conn
.
LocalAddr
()
.
String
()
==
conn
.
RemoteAddr
()
.
String
()
{
conn
.
Close
()
err
=
errSelfConnect
}
if
err
==
nil
{
...
...
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