summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helperfuncs.cpp6
-rw-r--r--src/inspircd.cpp1
-rw-r--r--src/userprocess.cpp21
-rw-r--r--src/users.cpp1
4 files changed, 17 insertions, 12 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 037a7a3af..c1a53b908 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -130,6 +130,7 @@ void Write(int sock,char *text, ...)
log(DEFAULT,"*** BUG *** Write was given an invalid parameter");
return;
}
+ log(DEBUG,"Write: Normal");
va_list argsPtr;
char textbuffer[MAXBUF],tb[MAXBUF];
va_start (argsPtr, text);
@@ -141,6 +142,7 @@ void Write(int sock,char *text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
+ log(DEBUG,"Write: IO Hooked");
Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
}
else
@@ -163,6 +165,7 @@ void WriteServ(int sock, char* text, ...)
log(DEFAULT,"*** BUG *** WriteServ was given an invalid parameter");
return;
}
+ log(DEBUG,"WriteServ: normal");
va_list argsPtr;
va_start (argsPtr, text);
char textbuffer[MAXBUF],tb[MAXBUF];
@@ -174,6 +177,7 @@ void WriteServ(int sock, char* text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
+ log(DEBUG,"WriteServ: IO Hooked");
Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
}
else
@@ -196,6 +200,7 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
log(DEFAULT,"*** BUG *** WriteFrom was given an invalid parameter");
return;
}
+ log(DEBUG,"WriteFrom: normal");
va_list argsPtr;
va_start (argsPtr, text);
char textbuffer[MAXBUF],tb[MAXBUF];
@@ -207,6 +212,7 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
{
if (Config->GetIOHook(fd_ref_table[sock]->port))
{
+ log(DEBUG,"WriteFrom: IO hooked");
Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
}
else
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c370c7f84..e65816f48 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -527,6 +527,7 @@ int InspIRCd::Run()
*/
if (incomingSockfd >= 0)
{
+ NonBlocking(incomingSockfd);
if (Config->GetIOHook(in_port))
{
Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, target, in_port);
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 31cb6b68e..6fc62cbdb 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -83,18 +83,17 @@ void ProcessUser(userrec* cu)
log(DEBUG,"Processing user with fd %d",cu->fd);
if (Config->GetIOHook(cu->port))
{
- int MOD_RESULT = 0;
int result2 = 0;
- Config->GetIOHook(cu->port)->OnRawSocketRead(cu->fd,data,65535,result2);
- if (!MOD_RESULT)
- {
- result = cu->ReadData(data, 65535);
- }
- else
- {
- log(DEBUG,"Data result returned by module: %d",MOD_RESULT);
- result = result2;
- }
+ int MOD_RESULT = Config->GetIOHook(cu->port)->OnRawSocketRead(cu->fd,data,65535,result2);
+ log(DEBUG,"Data result returned by module: %d",MOD_RESULT);
+ if (MOD_RESULT < 0)
+ {
+ result = EAGAIN;
+ }
+ else
+ {
+ result = result2;
+ }
}
else
{
diff --git a/src/users.cpp b/src/users.cpp
index 6388b456b..6706e8fef 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -555,7 +555,6 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
*/
clientlist[tempnick] = new userrec();
- NonBlocking(socket);
log(DEBUG,"AddClient: %lu %s %d %s",(unsigned long)socket,host,port,ip);
clientlist[tempnick]->fd = socket;