more
This commit is contained in:
parent
657b285375
commit
4244345eff
@ -11,14 +11,10 @@ namespace nntpchan
|
|||||||
class LineReader
|
class LineReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LineReader(size_t lineLimit);
|
|
||||||
|
|
||||||
/** @brief queue inbound data from connection */
|
/** @brief queue inbound data from connection */
|
||||||
void Data(const char *data, ssize_t s);
|
void Data(const char *data, ssize_t s);
|
||||||
|
|
||||||
/** implements IConnHandler */
|
|
||||||
virtual bool ShouldClose();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief handle a line from the client */
|
/** @brief handle a line from the client */
|
||||||
virtual void HandleLine(const std::string line) = 0;
|
virtual void HandleLine(const std::string line) = 0;
|
||||||
@ -27,8 +23,6 @@ private:
|
|||||||
|
|
||||||
std::stringstream m_line;
|
std::stringstream m_line;
|
||||||
std::string m_leftover;
|
std::string m_leftover;
|
||||||
bool m_close;
|
|
||||||
const size_t lineLimit;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
namespace nntpchan
|
namespace nntpchan
|
||||||
{
|
{
|
||||||
|
|
||||||
LineReader::LineReader(size_t limit) : m_close(false), lineLimit(limit) {}
|
|
||||||
|
|
||||||
void LineReader::Data(const char *data, ssize_t l)
|
void LineReader::Data(const char *data, ssize_t l)
|
||||||
{
|
{
|
||||||
if (l <= 0)
|
if (l <= 0)
|
||||||
@ -23,5 +21,4 @@ void LineReader::Data(const char *data, ssize_t l)
|
|||||||
m_line.clear();
|
m_line.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LineReader::ShouldClose() { return m_close; }
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace nntpchan
|
namespace nntpchan
|
||||||
{
|
{
|
||||||
HashedCredDB::HashedCredDB() : LineReader(1024) {}
|
HashedCredDB::HashedCredDB() : LineReader() {}
|
||||||
|
|
||||||
bool HashedCredDB::CheckLogin(const std::string &user, const std::string &passwd)
|
bool HashedCredDB::CheckLogin(const std::string &user, const std::string &passwd)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
namespace nntpchan
|
namespace nntpchan
|
||||||
{
|
{
|
||||||
NNTPServerHandler::NNTPServerHandler(fs::path storage)
|
NNTPServerHandler::NNTPServerHandler(fs::path storage)
|
||||||
: LineReader(1024), m_article(nullptr), m_auth(nullptr), m_store(storage), m_authed(false),
|
: LineReader(), m_article(nullptr), m_auth(nullptr), m_store(storage), m_authed(false),
|
||||||
m_state(eStateReadCommand)
|
m_state(eStateReadCommand)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user