summaryrefslogtreecommitdiff
path: root/include/sockets.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-07-31 03:22:23 -0400
committerAdam <Adam@anope.org>2011-07-31 03:22:23 -0400
commit1cb11bba5dd36c2ac1f02e7b49c659de142ce481 (patch)
tree1650215b843b98fc64991f373b018dc0b238975c /include/sockets.h
parentf29c88bcd535e6dcf3bbf453423bca4b697a60fc (diff)
Fixed a few small problems, including m_ssl's connect feature sometimes failing for no good reason
Diffstat (limited to 'include/sockets.h')
-rw-r--r--include/sockets.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/include/sockets.h b/include/sockets.h
index 5e5ca1fde..eb86130b5 100644
--- a/include/sockets.h
+++ b/include/sockets.h
@@ -152,6 +152,12 @@ class CoreExport SocketIO
*/
virtual ClientSocket *Accept(ListenSocket *s);
+ /** Check if a connection has been accepted
+ * @param s The client socket
+ * @return -1 on error, 0 to wait, 1 on success
+ */
+ virtual int Accepted(ClientSocket *cs);
+
/** Bind a socket
* @param s The socket
* @param ip The IP to bind to
@@ -160,12 +166,18 @@ class CoreExport SocketIO
virtual void Bind(Socket *s, const Anope::string &ip, int port = 0);
/** Connect the socket
- * @param s THe socket
+ * @param s The socket
* @param target IP to connect to
* @param port to connect to
*/
virtual void Connect(ConnectionSocket *s, const Anope::string &target, int port);
+ /** Check if this socket is connected
+ * @param s The socket
+ * @return -1 for error, 0 for wait, 1 for connected
+ */
+ virtual int Connected(ConnectionSocket *s);
+
/** Called when the socket is destructing
*/
virtual void Destroy() { }
@@ -352,6 +364,11 @@ class CoreExport ConnectionSocket : public BufferedSocket
*/
void Connect(const Anope::string &TargetHost, int Port);
+ /** Called when there is something to be received for this socket
+ * @return true on success, false to drop this socket
+ */
+ bool ProcessRead();
+
/** Called when the socket is ready to be written to
* @return true on success, false to drop this socket
*/
@@ -386,6 +403,16 @@ class CoreExport ClientSocket : public BufferedSocket
* @param addr Address the connection came from
*/
ClientSocket(ListenSocket *ls, int fd, const sockaddrs &addr);
+
+ /** Called when there is something to be received for this socket
+ * @return true on success, false to drop this socket
+ */
+ bool ProcessRead();
+
+ /** Called when the socket is ready to be written to
+ * @return true on success, false to drop this socket
+ */
+ bool ProcessWrite();
};
class CoreExport Pipe : public BufferedSocket