package mtproto

import (
	
	

	
	
	
)

func ( *Conn) ( *bin.Buffer) error {
	var  mt.NewSessionCreated
	if  := .Decode();  != nil {
		return errors.Wrap(, "decode")
	}
	.gotSession.Signal()

	 := proto.MessageID(.FirstMsgID).Time()
	 := .clock.Now()
	.log.Debug("Session created",
		zap.Int64("unique_id", .UniqueID),
		zap.Int64("first_msg_id", .FirstMsgID),
		zap.Time("first_msg_time", .Local()),
	)

	if (.Before() && .Sub() > maxPast) || .Sub() > maxFuture {
		.log.Warn("Local clock needs synchronization",
			zap.Time("first_msg_time", ),
			zap.Time("local", ),
			zap.Duration("time_difference", .Sub()),
		)
	}

	.storeSalt(.ServerSalt)
	if  := .handler.OnSession(.session());  != nil {
		return errors.Wrap(, "handler.OnSession")
	}
	return nil
}