Skip to content

Commit 0de0999

Browse files
committed
renamed OnListenerStart callback to OnBind internally, too
1 parent 8101c84 commit 0de0999

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

indi.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (a *App) OnStart(cb func()) *App {
4949

5050
// OnBind calls the passed callback for every address, that was bound without any errors
5151
func (a *App) OnBind(cb func(addr string)) *App {
52-
a.hooks.OnListenerStart = cb
52+
a.hooks.OnBind = cb
5353
return a
5454
}
5555

@@ -136,8 +136,8 @@ func (a *App) bind(r router.Router) ([]*tcp.Server, error) {
136136
src.Handler = a.newHTTPHandler(encryption.Plain)
137137
}
138138

139-
if a.hooks.OnListenerStart != nil {
140-
a.hooks.OnListenerStart(src.Addr)
139+
if a.hooks.OnBind != nil {
140+
a.hooks.OnBind(src.Addr)
141141
}
142142

143143
servers = append(servers, tcp.NewServer(listener, func(conn net.Conn) {
@@ -199,9 +199,9 @@ func (a *App) newHTTPHandler(enc encryption.Token) listenerHandler {
199199
}
200200

201201
type hooks struct {
202-
OnStart func()
203-
OnListenerStart func(addr string)
204-
OnStop func()
202+
OnStart func()
203+
OnBind func(addr string)
204+
OnStop func()
205205
}
206206

207207
func callIfNotNil(f func()) {

0 commit comments

Comments
 (0)