From 193b540aa750446bf67dcad132773541214c296d Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 31 Oct 2006 20:32:01 +0000 Subject: Socket error state stuff git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5607 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/dns.h | 2 +- include/inspircd.h | 2 +- include/inspsocket.h | 2 +- include/socket.h | 2 +- include/socketengine.h | 8 ++++++-- include/users.h | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/dns.h b/include/dns.h index b011a9ddb..79b286233 100644 --- a/include/dns.h +++ b/include/dns.h @@ -330,7 +330,7 @@ class DNS : public EventHandler * Handle a SocketEngine read event * Inherited from EventHandler */ - void HandleEvent(EventType et); + void HandleEvent(EventType et, int errornum = 0); /** * Add a Resolver* to the list of active classes diff --git a/include/inspircd.h b/include/inspircd.h index 3a752e21c..014f729b0 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -172,7 +172,7 @@ class FileLogger : public EventHandler * another write event is scheduled to write * the rest of the data when possible. */ - virtual void HandleEvent(EventType et); + virtual void HandleEvent(EventType et, int errornum = 0); /** Write one or more preformatted log lines. * If the data cannot be written immediately, * this class will insert itself into the diff --git a/include/inspsocket.h b/include/inspsocket.h index af92615ea..71f16951e 100644 --- a/include/inspsocket.h +++ b/include/inspsocket.h @@ -365,7 +365,7 @@ class InspSocket : public EventHandler */ void MarkAsClosed(); - void HandleEvent(EventType et); + void HandleEvent(EventType et, int errornum = 0); bool Readable(); }; diff --git a/include/socket.h b/include/socket.h index f868daf92..6264b196f 100644 --- a/include/socket.h +++ b/include/socket.h @@ -154,7 +154,7 @@ class ListenSocket : public EventHandler ListenSocket(InspIRCd* Instance, int sockfd, irc::sockets::insp_sockaddr client, irc::sockets::insp_sockaddr server, int port, char* addr); /** Handle an I/O event */ - void HandleEvent(EventType et); + void HandleEvent(EventType et, int errornum = 0); }; #endif diff --git a/include/socketengine.h b/include/socketengine.h index a4628b648..9b3cdec64 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -26,11 +26,15 @@ /** Types of event an EventHandler may receive. * EVENT_READ is a readable file descriptor, * and EVENT_WRITE is a writeable file descriptor. + * EVENT_ERROR can always occur, and indicates + * a write error or read error on the socket, + * e.g. EOF condition or broken pipe. */ enum EventType { EVENT_READ = 0, - EVENT_WRITE = 1 + EVENT_WRITE = 1, + EVENT_ERROR = 2 }; class InspIRCd; @@ -127,7 +131,7 @@ class EventHandler : public Extensible * @param et either one of EVENT_READ for read events, * and EVENT_WRITE for write events. */ - virtual void HandleEvent(EventType et) = 0; + virtual void HandleEvent(EventType et, int errornum = 0) = 0; }; /** Provides basic file-descriptor-based I/O support. diff --git a/include/users.h b/include/users.h index 1dc0aa43e..536f37a80 100644 --- a/include/users.h +++ b/include/users.h @@ -767,7 +767,7 @@ class userrec : public connection /** Handle socket event. * From EventHandler class. */ - void HandleEvent(EventType et); + void HandleEvent(EventType et, int errornum = 0); /** Default destructor */ -- cgit v1.2.3