summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-08 23:27:29 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-08 23:27:29 +0000
commit228665b0ab71ed83d2a987433117e8510bc76f78 (patch)
tree72654368543fcbc4dc4ff18bb72cf509608e52cc
parent95494e65270f9d52a09b458682dc41bf537d62aa (diff)
Fix problem #1 by setting a lock on writes when we're reading. This means no more stupid/pointless writes.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8670 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_xline_db.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index 93b13029d..d77f8e919 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -19,12 +19,17 @@
class ModuleXLineDB : public Module
{
std::vector<XLine *> xlines;
+ bool reading_db; // If this is true, addlines are as a result of db reading, so don't bother flushing the db to disk.
+ // DO REMEMBER TO SET IT, otherwise it's annoying :P
public:
ModuleXLineDB(InspIRCd* Me) : Module(Me)
{
Implementation eventlist[] = { I_OnAddLine, I_OnDelLine };
ServerInstance->Modules->Attach(eventlist, this, 2);
+
+ reading_db = true;
ReadDatabase();
+ reading_db = false;
}
virtual ~ModuleXLineDB()
@@ -47,7 +52,10 @@ class ModuleXLineDB : public Module
ServerInstance->Config->ServerName, line->set_time, line->duration, line->reason);
}
- WriteDatabase();
+ if (!reading_db)
+ {
+ WriteDatabase();
+ }
}
/** Called whenever an xline is deleted.