diff --git a/classic_impl.go b/classic_impl.go index 5a0c3d7..799a84f 100644 --- a/classic_impl.go +++ b/classic_impl.go @@ -105,7 +105,7 @@ func (impl *classicImpl) Certificates() []*x509.Certificate { } func (impl *classicImpl) Label() string { - return fmt.Sprintf("u{%s}->i{%s}", impl.LogicalName(), impl.ConnectionId()) + return fmt.Sprintf("u{%s}->i{%s/%s}", impl.LogicalName(), impl.id, impl.ConnectionId()) } func (impl *classicImpl) Close() error { diff --git a/reconnecting_dialer.go b/reconnecting_dialer.go index d81cf46..1f8d09f 100644 --- a/reconnecting_dialer.go +++ b/reconnecting_dialer.go @@ -165,8 +165,6 @@ func (dialer *reconnectingDialer) sendHello(impl *reconnectingImpl) error { if id, ok := response.GetStringHeader(IdHeader); ok { impl.id = &identity.TokenId{Token: id} - } else if certs := impl.Certificates(); len(certs) > 0 { - impl.id = &identity.TokenId{Token: certs[0].Subject.CommonName} } impl.headers.Store(response.Headers) diff --git a/reconnecting_impl.go b/reconnecting_impl.go index 0a7409c..e7bc0ff 100644 --- a/reconnecting_impl.go +++ b/reconnecting_impl.go @@ -107,7 +107,7 @@ func (impl *reconnectingImpl) Certificates() []*x509.Certificate { } func (impl *reconnectingImpl) Label() string { - return fmt.Sprintf("u{%s}->i{%s}", impl.LogicalName(), impl.ConnectionId()) + return fmt.Sprintf("u{%s}->i{%s/%s}", impl.LogicalName(), impl.id.Token, impl.ConnectionId()) } func (impl *reconnectingImpl) Close() error { @@ -122,7 +122,13 @@ func (impl *reconnectingImpl) IsClosed() bool { } func newReconnectingImpl(peer transport.Conn, reconnectionHandler reconnectionHandler, timeout time.Duration) *reconnectingImpl { + id := &identity.TokenId{Token: "unknown"} + if certs := peer.PeerCertificates(); len(certs) > 0 { + id = &identity.TokenId{Token: certs[0].Subject.CommonName} + } + return &reconnectingImpl{ + id: id, peer: peer, reconnectionHandler: reconnectionHandler, readF: ReadV2,