mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
added tick fn
cleaned up logical update behaviour, still needs fine tuning git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@578 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0108a247a5
commit
96ce0a8eff
1 changed files with 30 additions and 3 deletions
|
@ -49,7 +49,6 @@ p3Qblog::p3Qblog(p3ConnectMgr *connMgr,
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mBlogMtx);
|
RsStackMutex stack(mBlogMtx);
|
||||||
mOwnId = mConnMgr->getOwnId(); // get your own usr Id
|
mOwnId = mConnMgr->getOwnId(); // get your own usr Id
|
||||||
//bool ok = mConnMgr->getFriendList(FriendList);
|
|
||||||
loadDummy(); // load dummy data
|
loadDummy(); // load dummy data
|
||||||
|
|
||||||
#ifdef QBLOG_DEBUG
|
#ifdef QBLOG_DEBUG
|
||||||
|
@ -83,7 +82,10 @@ bool p3Qblog::loadLocalCache(const CacheData &data)
|
||||||
|
|
||||||
loadBlogFile(filename, source);
|
loadBlogFile(filename, source);
|
||||||
|
|
||||||
// TODO might need to add boolean saying cached blogs not posted
|
{
|
||||||
|
RsStackMutex stack(mBlogMtx);
|
||||||
|
mRepost = false; // there is nothing to tick/repost (i.e. comes from cache)
|
||||||
|
}
|
||||||
|
|
||||||
if (data.size > 0) /* don't refresh zero sized caches */
|
if (data.size > 0) /* don't refresh zero sized caches */
|
||||||
{
|
{
|
||||||
|
@ -207,6 +209,13 @@ bool p3Qblog::loadBlogFile(std::string filename, std::string src)
|
||||||
|
|
||||||
bool p3Qblog::addBlog(RsQblogItem *newBlog)
|
bool p3Qblog::addBlog(RsQblogItem *newBlog)
|
||||||
{
|
{
|
||||||
|
#ifdef QBLOG_DEBUG
|
||||||
|
std::cerr << "p3Ranking::addBlog() Item:";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
newBlog->print(std::cerr, 10); // check whats in the blog item
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex Stack(mBlogMtx);
|
RsStackMutex Stack(mBlogMtx);
|
||||||
|
|
||||||
|
@ -228,6 +237,8 @@ bool p3Qblog::addBlog(RsQblogItem *newBlog)
|
||||||
std::cerr << "\tmUsrBlogSet: blog" << newBlog->blogMsg.second;
|
std::cerr << "\tmUsrBlogSet: blog" << newBlog->blogMsg.second;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mUpdated = true; // might be useless
|
||||||
|
mRepost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -706,3 +717,19 @@ bool p3Qblog::sort(void)
|
||||||
// TODO sorts blog maps in time order
|
// TODO sorts blog maps in time order
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void p3Qblog::tick()
|
||||||
|
{
|
||||||
|
bool repost = false; // so stack mutex is not enabled during postblog call
|
||||||
|
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mBlogMtx);
|
||||||
|
repost = mRepost;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(repost) //
|
||||||
|
{
|
||||||
|
if(!postBlogs())
|
||||||
|
std::cerr << "p3Qblog::tick():" << "tick failed!";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue