mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Move GetNextLine from StreamSocket to TreeSocket.
This commit is contained in:
parent
90fb7c511f
commit
306594f591
@ -338,12 +338,6 @@ class CoreExport StreamSocket : public EventHandler
|
||||
/** Send the given data out the socket, either now or when writes unblock
|
||||
*/
|
||||
void WriteData(const std::string& data);
|
||||
/** Convenience function: read a line from the socket
|
||||
* @param line The line read
|
||||
* @param delim The line delimiter
|
||||
* @return true if a line was read
|
||||
*/
|
||||
bool GetNextLine(std::string& line, char delim = '\n');
|
||||
|
||||
/** Retrieves the current size of the send queue. */
|
||||
size_t GetSendQSize() const;
|
||||
|
@ -137,16 +137,6 @@ CullResult StreamSocket::cull()
|
||||
return EventHandler::cull();
|
||||
}
|
||||
|
||||
bool StreamSocket::GetNextLine(std::string& line, char delim)
|
||||
{
|
||||
std::string::size_type i = recvq.find(delim);
|
||||
if (i == std::string::npos)
|
||||
return false;
|
||||
line.assign(recvq, 0, i);
|
||||
recvq.erase(0, i + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
int StreamSocket::HookChainRead(IOHook* hook, std::string& rq)
|
||||
{
|
||||
if (!hook)
|
||||
|
@ -155,6 +155,13 @@ class TreeSocket : public BufferedSocket
|
||||
*/
|
||||
std::shared_ptr<Link> AuthRemote(const CommandBase::Params& params);
|
||||
|
||||
/** Convenience function: read a line from the socket
|
||||
* @param line The line read
|
||||
* @param delim The line delimiter
|
||||
* @return true if a line was read
|
||||
*/
|
||||
bool GetNextLine(std::string& line, char delim = '\n');
|
||||
|
||||
public:
|
||||
const time_t age;
|
||||
|
||||
|
@ -197,6 +197,16 @@ CmdResult CommandSQuit::HandleServer(TreeServer* server, CommandBase::Params& pa
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool TreeSocket::GetNextLine(std::string& line, char delim)
|
||||
{
|
||||
std::string::size_type i = recvq.find(delim);
|
||||
if (i == std::string::npos)
|
||||
return false;
|
||||
line.assign(recvq, 0, i);
|
||||
recvq.erase(0, i + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** This function is called when we receive data from a remote
|
||||
* server.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user