@@ -323,15 +323,24 @@ func describeNode(
323323 }, nil
324324}
325325
326- func newCreateSessionConfig ( opts ... options.SessionOption ) * options. CreateSessionOptions {
326+ func applyToSession ( t * trace. Coordination , opts ... options.SessionOption ) sessionOption {
327327 c := defaultCreateSessionConfig ()
328+
328329 for _ , o := range opts {
329330 if o != nil {
330331 o (c )
331332 }
332333 }
333334
334- return c
335+ return func (s * session ) {
336+ s .trace = t
337+ s .description = c .Description
338+ s .sessionTimeout = c .SessionTimeout
339+ s .sessionStartTimeout = c .SessionStartTimeout
340+ s .sessionStopTimeout = c .SessionStopTimeout
341+ s .sessionKeepAliveTimeout = c .SessionKeepAliveTimeout
342+ s .sessionReconnectDelay = c .SessionReconnectDelay
343+ }
335344}
336345
337346func (c * Client ) sessionCreated (s * session ) {
@@ -385,7 +394,22 @@ func (c *Client) Session(
385394 onDone (finalErr )
386395 }()
387396
388- return createSession (ctx , c , path , newCreateSessionConfig (opts ... ))
397+ s , err := createSession (ctx , c .client , path ,
398+ applyToSession (c .config .Trace (), opts ... ),
399+ func (s * session ) {
400+ s .onCreate = append (s .onCreate , func (s * session ) {
401+ c .sessionCreated (s )
402+ })
403+ s .onClose = append (s .onClose , func (s * session ) {
404+ c .sessionClosed (s )
405+ })
406+ },
407+ )
408+ if err != nil {
409+ return nil , xerrors .WithStackTrace (err )
410+ }
411+
412+ return s , nil
389413}
390414
391415func (c * Client ) Close (ctx context.Context ) (finalErr error ) {
0 commit comments