git.stg.codes
/
stg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5e4900a
)
Declare unary ctors explicit.
author
Maxim Mamontov
<faust.madf@gmail.com>
Mon, 21 Sep 2015 18:13:04 +0000
(21:13 +0300)
committer
Maxim Mamontov
<faust.madf@gmail.com>
Mon, 21 Sep 2015 18:13:04 +0000
(21:13 +0300)
include/stg/locker.h
patch
|
blob
|
history
projects/rlm_stg/conn.cpp
patch
|
blob
|
history
projects/rlm_stg/conn.h
patch
|
blob
|
history
projects/rlm_stg/stg_client.cpp
patch
|
blob
|
history
projects/rlm_stg/stg_client.h
patch
|
blob
|
history
stglibs/json.lib/include/stg/json_generator.h
patch
|
blob
|
history
stglibs/json.lib/include/stg/json_parser.h
patch
|
blob
|
history
diff --git
a/include/stg/locker.h
b/include/stg/locker.h
index 964f17cb44d7ccc0a3b037fe4a940ee9552016c0..16b0323f3876c78941fe41c2b7faa310741eb5bb 100644
(file)
--- a/
include/stg/locker.h
+++ b/
include/stg/locker.h
@@
-34,12
+34,12
@@
class STG_LOCKER
{
public:
class STG_LOCKER
{
public:
- STG_LOCKER(pthread_mutex_t& m)
+
explicit
STG_LOCKER(pthread_mutex_t& m)
: mutex(&m)
{
pthread_mutex_lock(mutex);
}
: mutex(&m)
{
pthread_mutex_lock(mutex);
}
- STG_LOCKER(pthread_mutex_t * m)
+
explicit
STG_LOCKER(pthread_mutex_t * m)
: mutex(m)
{
pthread_mutex_lock(mutex);
: mutex(m)
{
pthread_mutex_lock(mutex);
diff --git
a/projects/rlm_stg/conn.cpp
b/projects/rlm_stg/conn.cpp
index ed0b7a61a16d4c7ae590d351213d47cdc6594b4c..3ee720d19f2fae0b904b75266db225c2cf9fb3d1 100644
(file)
--- a/
projects/rlm_stg/conn.cpp
+++ b/
projects/rlm_stg/conn.cpp
@@
-55,10
+55,10
@@
double PING_TIMEOUT = 10;
struct ChannelConfig {
struct Error : std::runtime_error {
struct ChannelConfig {
struct Error : std::runtime_error {
- Error(const std::string& message) : runtime_error(message) {}
+
explicit
Error(const std::string& message) : runtime_error(message) {}
};
};
- ChannelConfig(std::string address);
+
explicit
ChannelConfig(std::string address);
std::string transport;
std::string key;
std::string transport;
std::string key;
@@
-195,7
+195,7
@@
class ProtoParser : public Parser
class PacketGen : public Gen
{
public:
class PacketGen : public Gen
{
public:
- PacketGen(const std::string& type)
+
explicit
PacketGen(const std::string& type)
: m_type(type)
{
m_gen.add("packet", m_type);
: m_type(type)
{
m_gen.add("packet", m_type);
@@
-348,6
+348,7
@@
Conn::Impl::Impl(const std::string& address, Callback callback, void* data)
m_parser(&Conn::Impl::process, this),
m_connected(true)
{
m_parser(&Conn::Impl::process, this),
m_connected(true)
{
+ RadLog("Created connection.");
pthread_mutex_init(&m_mutex, NULL);
int res = pthread_create(&m_thread, NULL, &Conn::Impl::run, this);
if (res != 0)
pthread_mutex_init(&m_mutex, NULL);
int res = pthread_create(&m_thread, NULL, &Conn::Impl::run, this);
if (res != 0)
@@
-360,6
+361,7
@@
Conn::Impl::~Impl()
shutdown(m_sock, SHUT_RDWR);
close(m_sock);
pthread_mutex_destroy(&m_mutex);
shutdown(m_sock, SHUT_RDWR);
close(m_sock);
pthread_mutex_destroy(&m_mutex);
+ RadLog("Deleted connection.");
}
bool Conn::Impl::stop()
}
bool Conn::Impl::stop()
@@
-407,6
+409,8
@@
void Conn::Impl::runImpl()
{
m_running = true;
{
m_running = true;
+ RadLog("Run connection.");
+
while (m_running) {
fd_set fds;
while (m_running) {
fd_set fds;
@@
-417,7
+421,9
@@
void Conn::Impl::runImpl()
tv.tv_sec = 0;
tv.tv_usec = 500000;
tv.tv_sec = 0;
tv.tv_usec = 500000;
+ RadLog("Starting 'select'.");
int res = select(m_sock + 1, &fds, NULL, NULL, &tv);
int res = select(m_sock + 1, &fds, NULL, NULL, &tv);
+ RadLog("'select' result: %d.", res);
if (res < 0)
{
if (errno == EINTR)
if (res < 0)
{
if (errno == EINTR)
@@
-426,6
+432,7
@@
void Conn::Impl::runImpl()
break;
}
break;
}
+
if (!m_running)
break;
if (!m_running)
break;
@@
-433,13
+440,17
@@
void Conn::Impl::runImpl()
if (res > 0)
{
if (res > 0)
{
+ RadLog("Got %d fds.", res);
if (FD_ISSET(m_sock, &fds))
m_running = read();
if (FD_ISSET(m_sock, &fds))
m_running = read();
+ RadLog("Read complete.");
}
else
m_running = tick();
}
}
else
m_running = tick();
}
+ RadLog("End running connection.");
+
m_connected = false;
m_stopped = true;
}
m_connected = false;
m_stopped = true;
}
@@
-627,6
+638,7
@@
bool Conn::Impl::write(void* data, const char* buf, size_t size)
RadLog("Failed to write data: %s.", strerror(errno));
return false;
}
RadLog("Failed to write data: %s.", strerror(errno));
return false;
}
+ RadLog("Send %d bytes.", res);
size -= res;
}
return true;
size -= res;
}
return true;
diff --git
a/projects/rlm_stg/conn.h
b/projects/rlm_stg/conn.h
index 4e7acc9b04998cd6287f0ce5c6623a2886a3f3cf..cecc080270bcc0c4e5b2163332c45d718fb08e3b 100644
(file)
--- a/
projects/rlm_stg/conn.h
+++ b/
projects/rlm_stg/conn.h
@@
-39,7
+39,7
@@
class Conn
{
public:
struct Error : std::runtime_error {
{
public:
struct Error : std::runtime_error {
- Error(const std::string& message) : runtime_error(message) {}
+
explicit
Error(const std::string& message) : runtime_error(message) {}
};
typedef bool (*Callback)(void* /*data*/, const RESULT& /*result*/, bool /*status*/);
};
typedef bool (*Callback)(void* /*data*/, const RESULT& /*result*/, bool /*status*/);
diff --git
a/projects/rlm_stg/stg_client.cpp
b/projects/rlm_stg/stg_client.cpp
index 75109511c507b6822c9b3156985d187be227ae29..239770deffdb068a77e83ba36c2dc2ddb193cc98 100644
(file)
--- a/
projects/rlm_stg/stg_client.cpp
+++ b/
projects/rlm_stg/stg_client.cpp
@@
-42,7
+42,7
@@
Client* stgClient = NULL;
class Client::Impl
{
public:
class Client::Impl
{
public:
- Impl(const std::string& address);
+
explicit
Impl(const std::string& address);
~Impl();
bool stop() { return m_conn ? m_conn->stop() : true; }
~Impl();
bool stop() { return m_conn ? m_conn->stop() : true; }
diff --git
a/projects/rlm_stg/stg_client.h
b/projects/rlm_stg/stg_client.h
index 334cede0ec9b2109dc07eae5cef7949a08168bd1..917d0e511fa18c68bef09587725a765dff3ab191 100644
(file)
--- a/
projects/rlm_stg/stg_client.h
+++ b/
projects/rlm_stg/stg_client.h
@@
-37,7
+37,7
@@
namespace RLM
class Client
{
public:
class Client
{
public:
- Client(const std::string& address);
+
explicit
Client(const std::string& address);
~Client();
bool stop();
~Client();
bool stop();
diff --git
a/stglibs/json.lib/include/stg/json_generator.h
b/stglibs/json.lib/include/stg/json_generator.h
index 96e454e3adf320db9620e78824b1fa4c0b421777..4f1523fc92f61929616adc4971aa13ae3ef60fb4 100644
(file)
--- a/
stglibs/json.lib/include/stg/json_generator.h
+++ b/
stglibs/json.lib/include/stg/json_generator.h
@@
-49,7
+49,7
@@
struct NullGen : public Gen
class BoolGen : public Gen
{
public:
class BoolGen : public Gen
{
public:
- BoolGen(bool value) : m_value(value) {}
+
explicit
BoolGen(bool value) : m_value(value) {}
virtual void run(yajl_gen_t* handle) const;
private:
bool m_value;
virtual void run(yajl_gen_t* handle) const;
private:
bool m_value;
@@
-58,7
+58,7
@@
class BoolGen : public Gen
class StringGen : public Gen
{
public:
class StringGen : public Gen
{
public:
- StringGen(const std::string& value) : m_value(value) {}
+
explicit
StringGen(const std::string& value) : m_value(value) {}
virtual void run(yajl_gen_t* handle) const;
private:
std::string m_value;
virtual void run(yajl_gen_t* handle) const;
private:
std::string m_value;
@@
-67,9
+67,9
@@
class StringGen : public Gen
class NumberGen : public Gen
{
public:
class NumberGen : public Gen
{
public:
- NumberGen(const std::string& value) : m_value(value) {}
+
explicit
NumberGen(const std::string& value) : m_value(value) {}
template <typename T>
template <typename T>
- NumberGen(const T& value) : m_value(x2str(value)) {}
+
explicit
NumberGen(const T& value) : m_value(x2str(value)) {}
virtual void run(yajl_gen_t* handle) const;
private:
std::string m_value;
virtual void run(yajl_gen_t* handle) const;
private:
std::string m_value;
diff --git
a/stglibs/json.lib/include/stg/json_parser.h
b/stglibs/json.lib/include/stg/json_parser.h
index d20e669df49543d0cf91538b6939faf08a6088c1..a614257944441c9c85248d0eec9ae68c504a7c01 100644
(file)
--- a/
stglibs/json.lib/include/stg/json_parser.h
+++ b/
stglibs/json.lib/include/stg/json_parser.h
@@
-51,7
+51,7
@@
struct NodeParser
class Parser
{
public:
class Parser
{
public:
- Parser(NodeParser* topParser);
+
explicit
Parser(NodeParser* topParser);
virtual ~Parser();
bool append(const char* data, size_t size);
virtual ~Parser();
bool append(const char* data, size_t size);