summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-12-19 01:23:42 +0100
committerattilamolnar <attilamolnar@hush.com>2012-12-21 18:26:22 +0100
commit401e01feb0aedc4d2ed7557a499e791f77699a01 (patch)
treecf3f85b1d1aa53de06f1e7bf9217263051c29d24 /src
parent092f9d7ec1ebb6dd1475c152de8fafe66e8da83b (diff)
Fix errors in socketengine_ports so it compiles on Solaris
Thanks to fraggeln for reporting and testing
Diffstat (limited to 'src')
-rw-r--r--src/socketengines/socketengine_ports.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp
index 9a86c47d0..52d799ddf 100644
--- a/src/socketengines/socketengine_ports.cpp
+++ b/src/socketengines/socketengine_ports.cpp
@@ -46,6 +46,7 @@ private:
/** These are used by epoll() to hold socket events
*/
port_event_t* events;
+ int EngineHandle;
public:
/** Create a new PortsEngine
*/
@@ -54,11 +55,10 @@ public:
*/
virtual ~PortsEngine();
virtual bool AddFd(EventHandler* eh, int event_mask);
- void OnSetEvent(EventHandler* eh, int old_event, int new_event);
+ virtual void OnSetEvent(EventHandler* eh, int old_mask, int new_mask);
virtual void DelFd(EventHandler* eh);
virtual int DispatchEvents();
virtual std::string GetName();
- virtual void WantWrite(EventHandler* eh);
};
#endif
@@ -131,7 +131,7 @@ bool PortsEngine::AddFd(EventHandler* eh, int event_mask)
return true;
}
-void PortsEngine::WantWrite(EventHandler* eh, int old_mask, int new_mask)
+void PortsEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask)
{
if (mask_to_events(new_mask) != mask_to_events(old_mask))
port_associate(EngineHandle, PORT_SOURCE_FD, eh->GetFd(), mask_to_events(new_mask), eh);
@@ -149,7 +149,6 @@ void PortsEngine::DelFd(EventHandler* eh)
ref[fd] = NULL;
ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
- return true;
}
int PortsEngine::DispatchEvents()
@@ -160,15 +159,16 @@ int PortsEngine::DispatchEvents()
poll_time.tv_nsec = 0;
unsigned int nget = 1; // used to denote a retrieve request.
- int i = port_getn(EngineHandle, this->events, GetMaxFds() - 1, &nget, &poll_time);
+ int ret = port_getn(EngineHandle, this->events, GetMaxFds() - 1, &nget, &poll_time);
ServerInstance->UpdateTime();
// first handle an error condition
- if (i == -1)
- return i;
+ if (ret == -1)
+ return -1;
TotalEvents += nget;
+ unsigned int i;
for (i = 0; i < nget; i++)
{
switch (this->events[i].portev_source)
@@ -185,7 +185,7 @@ int PortsEngine::DispatchEvents()
if (events[i].portev_events & POLLRDNORM)
mask &= ~FD_READ_WILL_BLOCK;
// reinsert port for next time around, pretending to be one-shot for writes
- SetEventMask(ev, mask);
+ SetEventMask(eh, mask);
port_associate(EngineHandle, PORT_SOURCE_FD, fd, mask_to_events(mask), eh);
if (events[i].portev_events & POLLRDNORM)
{
@@ -206,7 +206,7 @@ int PortsEngine::DispatchEvents()
}
}
- return i;
+ return (int)i;
}
std::string PortsEngine::GetName()