diff --git a/p2p/crypto/secio/protocol.go b/p2p/crypto/secio/protocol.go index 4dc64155f96dc21346d25e68013463a1f11e605e..9f90dc952b685e362362f77e2d0a00ba10ec155e 100644 --- a/p2p/crypto/secio/protocol.go +++ b/p2p/crypto/secio/protocol.go @@ -46,6 +46,14 @@ type secureSession struct { sharedSecret []byte } +func (s *secureSession) Loggable() map[string]interface{} { + m := make(map[string]interface{}) + m["localPeer"] = s.localPeer.Pretty() + m["remotePeer"] = s.remotePeer.Pretty() + m["established"] = (s.secure != nil) + return m +} + func newSecureSession(local peer.ID, key ci.PrivKey) (*secureSession, error) { s := &secureSession{localPeer: local, localKey: key} @@ -80,7 +88,7 @@ func (s *secureSession) handshake(ctx context.Context, insecure io.ReadWriter) e return err } - defer log.EventBegin(ctx, "secureHandshake", s.localPeer).Done() + defer log.EventBegin(ctx, "secureHandshake", s).Done() s.local.permanentPubKey = s.localKey.GetPublic() myPubKeyBytes, err := s.local.permanentPubKey.Bytes() @@ -292,6 +300,5 @@ func (s *secureSession) handshake(ctx context.Context, insecure io.ReadWriter) e } // Whew! ok, that's all folks. - log.Event(ctx, "secureHandshakeFinish", s.localPeer, s.remotePeer) return nil }