]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspsocket.cpp
Fix null dereference caused by tracking dummy
[user/henk/code/inspircd.git] / src / inspsocket.cpp
index d98fa1b61f199ca1dc8293125b89699b0a221df8..fc8bc142f9df2dfeb7ef54f4294e9fdb9dc7b8a9 100644 (file)
@@ -145,10 +145,10 @@ void StreamSocket::Close()
        errno = save;
 }
 
-bool StreamSocket::cull()
+CullResult StreamSocket::cull()
 {
        Close();
-       return true;
+       return EventHandler::cull();
 }
 
 bool StreamSocket::GetNextLine(std::string& line, char delim)
@@ -361,6 +361,11 @@ void StreamSocket::DoWrite()
                        else if (rv > 0)
                        {
                                // Partial write. Clean out strings from the sendq
+                               if (rv < rv_max)
+                               {
+                                       // it's going to block now
+                                       eventChange = FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK;
+                               }
                                sendq_len -= rv;
                                while (rv > 0 && !sendq.empty())
                                {
@@ -378,11 +383,6 @@ void StreamSocket::DoWrite()
                                                rv = 0;
                                        }
                                }
-                               if (rv < rv_max)
-                               {
-                                       // it's going to block now
-                                       eventChange = FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK;
-                               }
                        }
                        else if (rv == 0)
                        {