[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-197-
From: |
Francesco Pipita |
Subject: |
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-197-gda4c469 |
Date: |
Mon, 26 Apr 2010 12:23:53 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".
The branch, master has been updated
via da4c4695dacdc94e22a3f21e3abd946cbac15f6e (commit)
via c5feef014752ff113cfe2ac5995d317c363530c5 (commit)
via fc866506229720498f1a7afd4254bef208fbde9f (commit)
via b8cad10007ab27ec1d48444659f34d8b4a309072 (commit)
from 02495f9e5b945025cd4485ce714a5693611f0e52 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit da4c4695dacdc94e22a3f21e3abd946cbac15f6e
Merge: c5feef0 02495f9
Author: Francesco Pipita <address@hidden>
Date: Mon Apr 26 14:23:20 2010 +0200
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/myserver
commit c5feef014752ff113cfe2ac5995d317c363530c5
Author: Francesco Pipita <address@hidden>
Date: Mon Apr 26 14:14:23 2010 +0200
Handle the LogManager shutdown correctly.
diff --git a/myserver/include/log/log_manager.h
b/myserver/include/log/log_manager.h
index a22f72d..31230af 100644
--- a/myserver/include/log/log_manager.h
+++ b/myserver/include/log/log_manager.h
@@ -23,6 +23,7 @@
# include <map>
# include <string>
+# include <set>
# include <include/base/sync/mutex.h>
# include <include/filter/filters_factory.h>
diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index 0fcb350..8ec355f 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -137,8 +137,6 @@ LogManager::add (const void *owner, string type, string
location,
return failure;
}
- ostringstream oss;
-
oldSize = logStreamOwners[location].size ();
if (!containsOwner (owner))
{
@@ -271,26 +269,37 @@ LogManager::remove (const void *owner)
return 1;
}
+ set<string> toRemove;
+
map<string, map<string, LogStream*> >* m = &owners[owner];
map<string, map<string, LogStream*> >::iterator it_1;
+
for (it_1 = m->begin (); it_1 != m->end (); it_1++)
{
map<string, LogStream*> *t = &it_1->second;
map<string, LogStream*>::iterator it_2;
for (it_2 = t->begin (); it_2 != t->end (); it_2++)
{
- logStreamOwners[it_2->first].remove (owner);
- if (!logStreamOwners[it_2->first].size ())
- {
- delete it_2->second;
- logStreams.erase (it_2->first);
- logStreamOwners.erase (it_2->first);
- }
+ toRemove.insert (it_2->first);
}
t->clear ();
}
+
m->clear ();
owners.erase (owner);
+
+ set<string>::iterator i;
+ for (i = toRemove.begin (); i != toRemove.end (); i++)
+ {
+ logStreamOwners[*i].remove (owner);
+ if (!logStreamOwners[*i].size ())
+ {
+ delete logStreams[*i];
+ logStreams.erase (*i);
+ logStreamOwners.erase (*i);
+ }
+ }
+
failure = 0;
}
catch (...)
commit fc866506229720498f1a7afd4254bef208fbde9f
Author: Francesco Pipita <address@hidden>
Date: Sun Apr 25 15:42:03 2010 +0200
Code refactoring.
diff --git a/myserver/include/log/log_manager.h
b/myserver/include/log/log_manager.h
index 23aed94..a22f72d 100644
--- a/myserver/include/log/log_manager.h
+++ b/myserver/include/log/log_manager.h
@@ -43,7 +43,7 @@ public:
~LogManager ();
int add (const void *owner, string type, string location,
list<string>& filters, u_long cycle,
- int sharedStreamWarningOn = 1);
+ int suppressWarnings = 0);
int remove (const void *owner);
int log (const void* owner, string & message, bool appendNL = false,
diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index cb793bc..0fcb350 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -116,7 +116,7 @@ LogManager::clear ()
int
LogManager::add (const void *owner, string type, string location,
list<string>& filters, u_long cycle,
- int sharedStreamWarningOn)
+ int suppressWarnings)
{
int failure = 1;
int oldSize;
@@ -160,7 +160,7 @@ LogManager::add (const void *owner, string type, string
location,
mutex->unlock ();
if (!failure && newSize > oldSize && Server::getInstance () &&
- sharedStreamWarningOn)
+ !suppressWarnings)
return Server::getInstance ()->log (MYSERVER_LOG_MSG_WARNING,
_("The %s log is shared among %i
objects"),
location.c_str (), newSize);
diff --git a/myserver/tests/test_log_manager.cpp
b/myserver/tests/test_log_manager.cpp
index e8da8a4..df1fca1 100644
--- a/myserver/tests/test_log_manager.cpp
+++ b/myserver/tests/test_log_manager.cpp
@@ -735,7 +735,7 @@ public:
lm->add (this, "test", "file://foo", filters, 0);
- CPPUNIT_ASSERT (!lm->add (&anObject, "test", "file://foo", filters, 0, 0));
+ CPPUNIT_ASSERT (!lm->add (&anObject, "test", "file://foo", filters, 0, 1));
}
void testAddLogStreamSharedByTheSameObject ()
@@ -751,7 +751,7 @@ public:
lm->add (this, "test", "file://foo", filters, 0);
- CPPUNIT_ASSERT (! lm->add (this, "test1", "file://foo", filters, 0, 0));
+ CPPUNIT_ASSERT (! lm->add (this, "test1", "file://foo", filters, 0, 1));
}
void testGetLogStreamSharedByDistinctObjects ()
@@ -771,7 +771,7 @@ public:
}
lm->add (this, "test", "file://foo", filters, 0);
- lm->add (&anObject, "test", "file://foo", filters, 0, 0);
+ lm->add (&anObject, "test", "file://foo", filters, 0, 1);
lm->getOwnersList ("file://foo", &l);
lm->get (this, "test", "file://foo", &ls);
lm->get (&anObject, "test", "file://foo", &ls1);
@@ -819,8 +819,8 @@ public:
}
lm->add (this, "test", "file://foo", filters, 0);
- lm->add (&anObject, "test1", "file://foo", filters, 0, 0);
- lm->add (&anotherObject, "test2", "file://foo", filters, 0, 0);
+ lm->add (&anObject, "test1", "file://foo", filters, 0, 1);
+ lm->add (&anotherObject, "test2", "file://foo", filters, 0, 1);
lm->remove (this);
lm->remove (&anObject);
commit b8cad10007ab27ec1d48444659f34d8b4a309072
Author: Francesco Pipita <address@hidden>
Date: Sun Apr 25 14:00:25 2010 +0200
Suppress the shared stream warning messages when running tests.
diff --git a/myserver/include/log/log_manager.h
b/myserver/include/log/log_manager.h
index 99cca17..23aed94 100644
--- a/myserver/include/log/log_manager.h
+++ b/myserver/include/log/log_manager.h
@@ -42,7 +42,8 @@ public:
LogManager (FiltersFactory* ff, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
~LogManager ();
int add (const void *owner, string type, string location,
- list<string>& filters, u_long cycle);
+ list<string>& filters, u_long cycle,
+ int sharedStreamWarningOn = 1);
int remove (const void *owner);
int log (const void* owner, string & message, bool appendNL = false,
diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index 61c714e..cb793bc 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -115,7 +115,8 @@ LogManager::clear ()
*/
int
LogManager::add (const void *owner, string type, string location,
- list<string>& filters, u_long cycle)
+ list<string>& filters, u_long cycle,
+ int sharedStreamWarningOn)
{
int failure = 1;
int oldSize;
@@ -158,7 +159,8 @@ LogManager::add (const void *owner, string type, string
location,
mutex->unlock ();
- if (!failure && newSize > oldSize && Server::getInstance ())
+ if (!failure && newSize > oldSize && Server::getInstance () &&
+ sharedStreamWarningOn)
return Server::getInstance ()->log (MYSERVER_LOG_MSG_WARNING,
_("The %s log is shared among %i
objects"),
location.c_str (), newSize);
diff --git a/myserver/tests/test_log_manager.cpp
b/myserver/tests/test_log_manager.cpp
index 21fa5e0..e8da8a4 100644
--- a/myserver/tests/test_log_manager.cpp
+++ b/myserver/tests/test_log_manager.cpp
@@ -735,7 +735,7 @@ public:
lm->add (this, "test", "file://foo", filters, 0);
- CPPUNIT_ASSERT (!lm->add (&anObject, "test", "file://foo", filters, 0));
+ CPPUNIT_ASSERT (!lm->add (&anObject, "test", "file://foo", filters, 0, 0));
}
void testAddLogStreamSharedByTheSameObject ()
@@ -751,7 +751,7 @@ public:
lm->add (this, "test", "file://foo", filters, 0);
- CPPUNIT_ASSERT (! lm->add (this, "test1", "file://foo", filters, 0));
+ CPPUNIT_ASSERT (! lm->add (this, "test1", "file://foo", filters, 0, 0));
}
void testGetLogStreamSharedByDistinctObjects ()
@@ -771,7 +771,7 @@ public:
}
lm->add (this, "test", "file://foo", filters, 0);
- lm->add (&anObject, "test", "file://foo", filters, 0);
+ lm->add (&anObject, "test", "file://foo", filters, 0, 0);
lm->getOwnersList ("file://foo", &l);
lm->get (this, "test", "file://foo", &ls);
lm->get (&anObject, "test", "file://foo", &ls1);
@@ -795,7 +795,7 @@ public:
}
lm->add (this, "test", "file://foo", filters, 0);
- lm->add (this, "test1", "file://foo", filters, 0);
+ lm->add (this, "test1", "file://foo", filters, 0, 1);
lm->getOwnersList ("file://foo", &l);
lm->get (this, "test", "file://foo", &ls);
lm->get (this, "test1", "file://foo", &ls1);
@@ -819,8 +819,8 @@ public:
}
lm->add (this, "test", "file://foo", filters, 0);
- lm->add (&anObject, "test1", "file://foo", filters, 0);
- lm->add (&anotherObject, "test2", "file://foo", filters, 0);
+ lm->add (&anObject, "test1", "file://foo", filters, 0, 0);
+ lm->add (&anotherObject, "test2", "file://foo", filters, 0, 0);
lm->remove (this);
lm->remove (&anObject);
-----------------------------------------------------------------------
Summary of changes:
myserver/include/log/log_manager.h | 4 +++-
myserver/src/log/log_manager.cpp | 33 ++++++++++++++++++++++-----------
myserver/tests/test_log_manager.cpp | 12 ++++++------
3 files changed, 31 insertions(+), 18 deletions(-)
hooks/post-receive
--
GNU MyServer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-197-gda4c469,
Francesco Pipita <=