summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/snomasks.cpp2
-rw-r--r--src/users.cpp20
2 files changed, 18 insertions, 4 deletions
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index 2ab473b45..eaa7bd1f1 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -158,7 +158,7 @@ void Snomask::Flush()
{
// XXX this is a bit ugly.
std::string sno;
- sno[0] = MySnomask;
+ sno += MySnomask;
ServerInstance->PI->SendSNONotice(sno, this->Description + ": " + this->LastMessage);
if (Count > 1)
diff --git a/src/users.cpp b/src/users.cpp
index 108ce1385..9276f7d93 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -21,17 +21,19 @@
#include "bancache.h"
#include "commands/cmd_whowas.h"
+/* XXX: Used for speeding up WriteCommon operations */
+unsigned long uniq_id = 1;
+
static unsigned long* already_sent = NULL;
void InitializeAlreadySent(SocketEngine* SE)
{
already_sent = new unsigned long[SE->GetMaxFds()];
- memset(already_sent, 0, sizeof(already_sent));
+ memset(already_sent, 0, SE->GetMaxFds() * sizeof(long));
+ printf("\n\nInit Already Sent, uniq id = %lu\n\n", uniq_id);
}
-/* XXX: Used for speeding up WriteCommon operations */
-unsigned long uniq_id = 1;
std::string User::ProcessNoticeMasks(const char *sm)
{
@@ -620,17 +622,24 @@ void User::AddWriteBuf(const std::string &data)
// send AS MUCH OF THE USERS SENDQ as we are able to (might not be all of it)
void User::FlushWriteBuf()
{
+ printf("\nFlush buffer on %d\n", this->GetFd());
try
{
+ printf("1\n");
if ((this->fd == FD_MAGIC_NUMBER) || (*this->GetWriteError()))
{
+ printf("Write error set, clear sendq: %s\n", this->GetWriteError());
sendq.clear();
}
+ printf("2 sendq len = %u fd = %d\n", sendq.length(), this->fd);
if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER))
{
+ printf("3\n");
int old_sendq_length = sendq.length();
int n_sent = ServerInstance->SE->Send(this, this->sendq.data(), this->sendq.length(), 0);
+ printf("\nWrote %d\n", n_sent);
+
if (n_sent == -1)
{
if (errno == EAGAIN)
@@ -645,6 +654,7 @@ void User::FlushWriteBuf()
/* Fatal error, set write error and bail
*/
this->SetWriteError(errno ? strerror(errno) : "EOF from client");
+ printf("\nError on %d\n", this->GetFd());
return;
}
}
@@ -667,6 +677,8 @@ void User::FlushWriteBuf()
ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::FlushWriteBuf()");
}
+ printf("end flush\n");
+
if (this->sendq.empty())
{
FOREACH_MOD(I_OnBufferFlushed,OnBufferFlushed(this));
@@ -675,6 +687,7 @@ void User::FlushWriteBuf()
void User::SetWriteError(const std::string &error)
{
+ printf("SET WRITE ERROR: %s\n", error.c_str());
// don't try to set the error twice, its already set take the first string.
if (this->WriteError.empty())
this->WriteError = error;
@@ -1137,6 +1150,7 @@ const char* User::GetIPString(bool translate4in6)
*/
void User::Write(std::string text)
{
+ printf("Write Error is %s\n", *(GetWriteError()) ? "set" : "unset");
if (!ServerInstance->SE->BoundsCheckFd(this))
return;