Move socket write event handling in to the RFB core
What to do when a socket is writeable should be handled in the
RFB core code as there may be other events we want to fire off
when this happens.
diff --git a/common/rfb/HTTPServer.cxx b/common/rfb/HTTPServer.cxx
index f50722a..54becbb 100644
--- a/common/rfb/HTTPServer.cxx
+++ b/common/rfb/HTTPServer.cxx
@@ -337,7 +337,7 @@
}
void
-HTTPServer::processSocketEvent(network::Socket* sock) {
+HTTPServer::processSocketReadEvent(network::Socket* sock) {
std::list<Session*>::iterator i;
for (i=sessions.begin(); i!=sessions.end(); i++) {
if ((*i)->getSock() == sock) {
@@ -356,6 +356,23 @@
throw rdr::Exception("invalid Socket in HTTPServer");
}
+void
+HTTPServer::processSocketWriteEvent(network::Socket* sock) {
+ std::list<Session*>::iterator i;
+ for (i=sessions.begin(); i!=sessions.end(); i++) {
+ if ((*i)->getSock() == sock) {
+ try {
+ sock->outStream().flush();
+ } catch (rdr::Exception& e) {
+ vlog.error("untrapped: %s", e.str());
+ sock->shutdown();
+ }
+ return;
+ }
+ }
+ throw rdr::Exception("invalid Socket in HTTPServer");
+}
+
void HTTPServer::getSockets(std::list<network::Socket*>* sockets)
{
sockets->clear();