@@ -32,7 +32,7 @@ type Dialer interface {
3232 mustEmbedUnimplementedDialer ()
3333}
3434
35- type newDialerFunc func (context.Context , * Config ) (Dialer , error )
35+ type newDialerFunc func (context.Context , * Config , Core ) (Dialer , error )
3636
3737var (
3838 knownDialerVersions = make (map [string ]newDialerFunc )
@@ -117,10 +117,11 @@ func NewDialerWithContext(ctx context.Context, c *Config) (Dialer, error) {
117117 // in a more organized way.
118118 for exportName := range core .Exports () {
119119 if f , ok := knownDialerVersions [exportName ]; ok {
120- return f (ctx , c )
120+ return f (ctx , c , core )
121121 }
122122 }
123123
124+ core .Close ()
124125 return nil , ErrDialerVersionNotFound
125126}
126127
@@ -144,7 +145,7 @@ type FixedDialer interface {
144145 mustEmbedUnimplementedFixedDialer ()
145146}
146147
147- type newFixedDialerFunc func (context.Context , * Config ) (FixedDialer , error )
148+ type newFixedDialerFunc func (context.Context , * Config , Core ) (FixedDialer , error )
148149
149150var (
150151 knownFixedDialerVersions = make (map [string ]newFixedDialerFunc )
@@ -190,9 +191,10 @@ func NewFixedDialerWithContext(ctx context.Context, cfg *Config) (FixedDialer, e
190191 // Sniff the version of the dialer
191192 for exportName := range core .Exports () {
192193 if f , ok := knownFixedDialerVersions [exportName ]; ok {
193- return f (ctx , cfg )
194+ return f (ctx , cfg , core )
194195 }
195196 }
196197
198+ core .Close ()
197199 return nil , ErrFixedDialerVersionNotFound
198200}
0 commit comments