Skip to content

Commit 45048cc

Browse files
committed
notifications
1 parent 012bdcf commit 45048cc

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func (c *client) attemptConnection(isReconnect bool, attempt int) (net.Conn, byt
382382
tlsCfg = c.options.OnConnectAttempt(broker, c.options.TLSConfig)
383383
}
384384
if c.options.OnConnectionNotification != nil {
385-
c.options.OnConnectionNotification(c, ConnectionNotificationAttempt{broker})
385+
c.options.OnConnectionNotification(c, ConnectionNotificationBroker{broker})
386386
}
387387
connDeadline := time.Now().Add(c.options.ConnectTimeout) // Time by which connection must be established
388388
dialer := c.options.Dialer
@@ -401,7 +401,7 @@ func (c *client) attemptConnection(isReconnect bool, attempt int) (net.Conn, byt
401401
WARN.Println(CLI, "failed to connect to broker, trying next")
402402
rc = packets.ErrNetworkError
403403
if c.options.OnConnectionNotification != nil {
404-
c.options.OnConnectionNotification(c, ConnectionNotificationAttemptFailed{broker, err})
404+
c.options.OnConnectionNotification(c, ConnectionNotificationBrokerFailed{broker, err})
405405
}
406406
continue
407407
}

connnotf.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const (
99
ConnectionNotificationTypeConnecting
1010
ConnectionNotificationTypeFailed
1111
ConnectionNotificationTypeLost
12-
ConnectionNotificationTypeAttempt
13-
ConnectionNotificationTypeAttemptFailed
12+
ConnectionNotificationTypeBroker
13+
ConnectionNotificationTypeBrokerFailed
1414
)
1515

1616
type ConnectionNotification interface {
@@ -57,23 +57,23 @@ func (n ConnectionNotificationLost) Type() ConnectionNotificationType {
5757
return ConnectionNotificationTypeLost
5858
}
5959

60-
// Connection Attempt
60+
// Broker Connection
6161

62-
type ConnectionNotificationAttempt struct {
62+
type ConnectionNotificationBroker struct {
6363
Broker *url.URL
6464
}
6565

66-
func (n ConnectionNotificationAttempt) Type() ConnectionNotificationType {
67-
return ConnectionNotificationTypeAttempt
66+
func (n ConnectionNotificationBroker) Type() ConnectionNotificationType {
67+
return ConnectionNotificationTypeBroker
6868
}
6969

70-
// Connection Attempt Failed
70+
// Broker Connection Failed
7171

72-
type ConnectionNotificationAttemptFailed struct {
72+
type ConnectionNotificationBrokerFailed struct {
7373
Broker *url.URL
7474
Reason error
7575
}
7676

77-
func (n ConnectionNotificationAttemptFailed) Type() ConnectionNotificationType {
78-
return ConnectionNotificationTypeAttemptFailed
77+
func (n ConnectionNotificationBrokerFailed) Type() ConnectionNotificationType {
78+
return ConnectionNotificationTypeBrokerFailed
7979
}

0 commit comments

Comments
 (0)