git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor change in BFStream.
[stg.git]
/
projects
/
stargazer
/
services_impl.cpp
diff --git
a/projects/stargazer/services_impl.cpp
b/projects/stargazer/services_impl.cpp
index 85b0f4e51105f0cf01bea9dddcb7da40aa560626..aebb98fb84cf0653765b27d645cca8d46dccd968 100644
(file)
--- a/
projects/stargazer/services_impl.cpp
+++ b/
projects/stargazer/services_impl.cpp
@@
-43,12
+43,12
@@
Read();
//-----------------------------------------------------------------------------
int SERVICES_IMPL::Add(const SERVICE_CONF & service, const ADMIN * admin)
{
//-----------------------------------------------------------------------------
int SERVICES_IMPL::Add(const SERVICE_CONF & service, const ADMIN * admin)
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
- string s = admin->GetLogStr() + " Add service \'" + service.name + "\'. Access denied.";
+ st
d::st
ring s = admin->GetLogStr() + " Add service \'" + service.name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
@@
-79,14
+79,14
@@
WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str());
return -1;
}
//-----------------------------------------------------------------------------
return -1;
}
//-----------------------------------------------------------------------------
-int SERVICES_IMPL::Del(const string & name, const ADMIN * admin)
+int SERVICES_IMPL::Del(const st
d::st
ring & name, const ADMIN * admin)
{
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
- string s = admin->GetLogStr() + " Delete service \'" + name + "\'. Access denied.";
+ st
d::st
ring s = admin->GetLogStr() + " Delete service \'" + name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
@@
-101,7
+101,7
@@
if (si == data.end())
return -1;
}
return -1;
}
-map<int, const_srv_iter>::iterator csi;
+
std::
map<int, const_srv_iter>::iterator csi;
csi = searchDescriptors.begin();
while (csi != searchDescriptors.end())
{
csi = searchDescriptors.begin();
while (csi != searchDescriptors.end())
{
@@
-125,12
+125,12
@@
return 0;
//-----------------------------------------------------------------------------
int SERVICES_IMPL::Change(const SERVICE_CONF & service, const ADMIN * admin)
{
//-----------------------------------------------------------------------------
int SERVICES_IMPL::Change(const SERVICE_CONF & service, const ADMIN * admin)
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
const PRIV * priv = admin->GetPriv();
if (!priv->serviceChg)
{
- string s = admin->GetLogStr() + " Change service \'" + service.name + "\'. Access denied.";
+ st
d::st
ring s = admin->GetLogStr() + " Change service \'" + service.name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
strError = "Access denied.";
WriteServLog(s.c_str());
return -1;
@@
-161,8
+161,8
@@
return 0;
//-----------------------------------------------------------------------------
bool SERVICES_IMPL::Read()
{
//-----------------------------------------------------------------------------
bool SERVICES_IMPL::Read()
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
-
vector<
string> servicesList;
+STG_LOCKER lock(&mutex);
+
std::vector<std::
string> servicesList;
if (store->GetServicesList(&servicesList) < 0)
{
WriteServLog(store->GetStrError().c_str());
if (store->GetServicesList(&servicesList) < 0)
{
WriteServLog(store->GetStrError().c_str());
@@
-184,11
+184,11
@@
for (size_t i = 0; i < servicesList.size(); i++)
return false;
}
//-----------------------------------------------------------------------------
return false;
}
//-----------------------------------------------------------------------------
-bool SERVICES_IMPL::Find(const string & name, SERVICE_CONF * service)
+bool SERVICES_IMPL::Find(const st
d::st
ring & name, SERVICE_CONF * service)
{
assert(service != NULL && "Pointer to service is not null");
{
assert(service != NULL && "Pointer to service is not null");
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
if (data.empty())
return false;
if (data.empty())
return false;
@@
-203,9
+203,9
@@
if (si != data.end())
return true;
}
//-----------------------------------------------------------------------------
return true;
}
//-----------------------------------------------------------------------------
-bool SERVICES_IMPL::Exists(const string & name) const
+bool SERVICES_IMPL::Exists(const st
d::st
ring & name) const
{
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
if (data.empty())
{
printfd(__FILE__, "no admin in system!\n");
if (data.empty())
{
printfd(__FILE__, "no admin in system!\n");
@@
-222,7
+222,7
@@
return false;
//-----------------------------------------------------------------------------
int SERVICES_IMPL::OpenSearch() const
{
//-----------------------------------------------------------------------------
int SERVICES_IMPL::OpenSearch() const
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
handle++;
searchDescriptors[handle] = data.begin();
return handle;
handle++;
searchDescriptors[handle] = data.begin();
return handle;
@@
-230,7
+230,7
@@
return handle;
//-----------------------------------------------------------------------------
int SERVICES_IMPL::SearchNext(int h, SERVICE_CONF * service) const
{
//-----------------------------------------------------------------------------
int SERVICES_IMPL::SearchNext(int h, SERVICE_CONF * service) const
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
if (searchDescriptors.find(h) == searchDescriptors.end())
{
WriteServLog("SERVICES. Incorrect search handle.");
if (searchDescriptors.find(h) == searchDescriptors.end())
{
WriteServLog("SERVICES. Incorrect search handle.");
@@
-247,7
+247,7
@@
return 0;
//-----------------------------------------------------------------------------
int SERVICES_IMPL::CloseSearch(int h) const
{
//-----------------------------------------------------------------------------
int SERVICES_IMPL::CloseSearch(int h) const
{
-STG_LOCKER lock(&mutex
, __FILE__, __LINE__
);
+STG_LOCKER lock(&mutex);
if (searchDescriptors.find(h) != searchDescriptors.end())
{
searchDescriptors.erase(searchDescriptors.find(h));
if (searchDescriptors.find(h) != searchDescriptors.end())
{
searchDescriptors.erase(searchDescriptors.find(h));