Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
96cad134
Commit
96cad134
authored
Jan 28, 2015
by
Juan Batiz-Benet
Browse files
p2p/net: better dial log.Event
parent
d53edf17
Changes
1
Hide whitespace changes
Inline
Side-by-side
net/conn/dial.go
View file @
96cad134
...
@@ -28,6 +28,7 @@ func (d *Dialer) String() string {
...
@@ -28,6 +28,7 @@ func (d *Dialer) String() string {
// Example: d.DialAddr(ctx, peer.Addresses()[0], peer)
// Example: d.DialAddr(ctx, peer.Addresses()[0], peer)
func
(
d
*
Dialer
)
Dial
(
ctx
context
.
Context
,
raddr
ma
.
Multiaddr
,
remote
peer
.
ID
)
(
Conn
,
error
)
{
func
(
d
*
Dialer
)
Dial
(
ctx
context
.
Context
,
raddr
ma
.
Multiaddr
,
remote
peer
.
ID
)
(
Conn
,
error
)
{
logdial
:=
lgbl
.
Dial
(
"conn"
,
d
.
LocalPeer
,
remote
,
nil
,
raddr
)
logdial
:=
lgbl
.
Dial
(
"conn"
,
d
.
LocalPeer
,
remote
,
nil
,
raddr
)
logdial
[
"encrypted"
]
=
(
d
.
PrivateKey
!=
nil
)
// log wether this will be an encrypted dial or not.
defer
log
.
EventBegin
(
ctx
,
"connDial"
,
logdial
)
.
Done
()
defer
log
.
EventBegin
(
ctx
,
"connDial"
,
logdial
)
.
Done
()
maconn
,
err
:=
d
.
rawConnDial
(
ctx
,
raddr
,
remote
)
maconn
,
err
:=
d
.
rawConnDial
(
ctx
,
raddr
,
remote
)
...
@@ -53,12 +54,10 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) (
...
@@ -53,12 +54,10 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) (
if
d
.
PrivateKey
==
nil
{
if
d
.
PrivateKey
==
nil
{
log
.
Warning
(
"dialer %s dialing INSECURELY %s at %s!"
,
d
,
remote
,
raddr
)
log
.
Warning
(
"dialer %s dialing INSECURELY %s at %s!"
,
d
,
remote
,
raddr
)
log
.
Event
(
ctx
,
"connDialInsecure"
,
logdial
)
connOut
=
c
connOut
=
c
return
return
}
}
defer
log
.
EventBegin
(
ctx
,
"connDialEncrypt"
,
logdial
)
.
Done
()
c2
,
err
:=
newSecureConn
(
ctx
,
d
.
PrivateKey
,
c
)
c2
,
err
:=
newSecureConn
(
ctx
,
d
.
PrivateKey
,
c
)
if
err
!=
nil
{
if
err
!=
nil
{
logdial
[
"error"
]
=
err
logdial
[
"error"
]
=
err
...
...
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