projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sru_z3950: fix facet response (memory corruption) MP-532
[metaproxy-moved-to-github.git]
/
src
/
filter_session_shared.cpp
diff --git
a/src/filter_session_shared.cpp
b/src/filter_session_shared.cpp
index
00b05c9
..
9c353fa
100644
(file)
--- a/
src/filter_session_shared.cpp
+++ b/
src/filter_session_shared.cpp
@@
-1,5
+1,5
@@
/* This file is part of Metaproxy.
/* This file is part of Metaproxy.
- Copyright (C) 2005-2013 Index Data
+ Copyright (C) Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-193,6
+193,7
@@
namespace metaproxy_1 {
void release_frontend(Package &package);
Rep();
public:
void release_frontend(Package &package);
Rep();
public:
+ ~Rep();
void expire();
private:
void expire_classes();
void expire();
private:
void expire_classes();
@@
-202,6
+203,7
@@
namespace metaproxy_1 {
void start();
boost::mutex m_mutex;
boost::condition m_cond_session_ready;
void start();
boost::mutex m_mutex;
boost::condition m_cond_session_ready;
+ boost::condition m_cond_expire_ready;
std::map<mp::Session, FrontendPtr> m_clients;
BackendClassMap m_backend_map;
std::map<mp::Session, FrontendPtr> m_clients;
BackendClassMap m_backend_map;
@@
-215,6
+217,7
@@
namespace metaproxy_1 {
int m_session_max;
Odr_int m_preferredMessageSize;
Odr_int m_maximumRecordSize;
int m_session_max;
Odr_int m_preferredMessageSize;
Odr_int m_maximumRecordSize;
+ bool close_down;
};
}
}
};
}
}
@@
-1128,8
+1131,7
@@
void yf::SessionShared::Frontend::present(mp::Package &package,
found_set->m_record_cache.add(
odr,
b_resp->records->u.databaseOrSurDiagnostics,
found_set->m_record_cache.add(
odr,
b_resp->records->u.databaseOrSurDiagnostics,
- *req->resultSetStartPoint,
- *f_resp->numberOfRecordsReturned);
+ *req->resultSetStartPoint, p_req->recordComposition);
}
bc->release_backend(found_backend);
}
}
bc->release_backend(found_backend);
}
@@
-1240,15
+1242,19
@@
void yf::SessionShared::Rep::expire()
{
boost::xtime xt;
boost::xtime_get(&xt,
{
boost::xtime xt;
boost::xtime_get(&xt,
-#if BOOST_VERSION >= 105000
+#if BOOST_VERSION >= 105000
boost::TIME_UTC_
#else
boost::TIME_UTC
#endif
);
xt.sec += m_session_ttl / 3;
boost::TIME_UTC_
#else
boost::TIME_UTC
#endif
);
xt.sec += m_session_ttl / 3;
- boost::thread::sleep(xt);
-
+ {
+ boost::mutex::scoped_lock lock(m_mutex);
+ m_cond_expire_ready.timed_wait(lock, xt);
+ if (close_down)
+ break;
+ }
stat();
expire_classes();
}
stat();
expire_classes();
}
@@
-1264,6
+1270,17
@@
yf::SessionShared::Rep::Rep()
m_session_max = 100;
m_preferredMessageSize = 0;
m_maximumRecordSize = 0;
m_session_max = 100;
m_preferredMessageSize = 0;
m_maximumRecordSize = 0;
+ close_down = false;
+}
+
+yf::SessionShared::Rep::~Rep()
+{
+ {
+ boost::mutex::scoped_lock lock(m_mutex);
+ close_down = true;
+ m_cond_expire_ready.notify_all();
+ }
+ m_thrds.join_all();
}
void yf::SessionShared::Rep::start()
}
void yf::SessionShared::Rep::start()