+ // scope for session lock
+ {
+ boost::mutex::scoped_lock scoped_lock(m_session_mutex);
+
+ if (gdu && gdu->which == Z_GDU_Z3950)
+ {
+ Z_APDU *apdu_req = gdu->u.z3950;
+ if (apdu_req->which == Z_APDU_initRequest)
+ {
+ Z_InitRequest *req = apdu_req->u.initRequest;
+ Z_IdAuthentication *a = req->idAuthentication;
+ if (a)
+ {
+ if (a->which == Z_IdAuthentication_idPass)
+ user = a->u.idPass->userId;
+ else if (a->which == Z_IdAuthentication_open)
+ user = a->u.open;
+
+ m_sessions[package.session()] = user;
+ }
+ }
+ }
+ std::map<mp::Session,std::string>::iterator it =
+ m_sessions.find(package.session());
+ if (it != m_sessions.end())
+ user = it->second;
+
+ if (package.session().is_closed())
+ m_sessions.erase(package.session());
+ }
+ // scope for locking Ostream