@@ -676,6 +676,9 @@ ULONG ConfigStorage::getSessionSize(const TraceSession& session) noexcept
676676 if ((len = session.ses_logfile .length ()))
677677 ret += sz + len;
678678
679+ if ((len = session.ses_plugins .length ()))
680+ ret += sz + len;
681+
679682 ret += sz + sizeof (session.ses_start );
680683
681684 return ret;
@@ -717,25 +720,16 @@ void ConfigStorage::addSession(TraceSession& session)
717720 char * p = reinterpret_cast <char *> (header) + slot->offset ;
718721 Writer writer (p, slot->size );
719722
720- if (!session.ses_name .empty ()) {
721- writer.write (tagName, session.ses_name .length (), session.ses_name .c_str ());
722- }
723- if (session.ses_auth .hasData ()) {
723+ writer.writeStringIfExists (tagName, session.ses_name );
724+ if (session.ses_auth .hasData ())
724725 writer.write (tagAuthBlock, session.ses_auth .getCount (), session.ses_auth .begin ());
725- }
726- if (!session.ses_user .empty ()) {
727- writer.write (tagUserName, session.ses_user .length (), session.ses_user .c_str ());
728- }
729- if (session.ses_role .hasData ()) {
730- writer.write (tagRole, session.ses_role .length (), session.ses_role .c_str ());
731- }
732- if (!session.ses_config .empty ()) {
733- writer.write (tagConfig, session.ses_config .length (), session.ses_config .c_str ());
734- }
726+ writer.writeStringIfExists (tagUserName, session.ses_user );
727+ writer.writeStringIfExists (tagRole, session.ses_role );
728+ writer.writeStringIfExists (tagConfig, session.ses_config );
735729 writer.write (tagStartTS, sizeof (session.ses_start ), &session.ses_start );
736- if (! session.ses_logfile . empty ()) {
737- writer.write (tagLogFile , session.ses_logfile . length (), session. ses_logfile . c_str () );
738- }
730+ writer. writeStringIfExists (tagLogFile, session.ses_logfile );
731+ writer.writeStringIfExists (tagPlugins , session.ses_plugins );
732+
739733 writer.write (tagEnd, 0 , NULL );
740734}
741735
@@ -841,6 +835,10 @@ bool ConfigStorage::readSession(const TraceCSHeader::Slot* slot, TraceSession& s
841835 p = session.ses_role .getBuffer (len);
842836 break ;
843837
838+ case tagPlugins:
839+ p = session.ses_plugins .getBuffer (len);
840+ break ;
841+
844842 default :
845843 fb_assert (false );
846844 return false ;
0 commit comments