aboutsummaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc
diff options
context:
space:
mode:
Diffstat (limited to 'unix/xserver/hw/vnc')
-rw-r--r--unix/xserver/hw/vnc/RFBGlue.cc7
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc38
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h8
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc6
4 files changed, 35 insertions, 24 deletions
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
index a1507924..9a014f17 100644
--- a/unix/xserver/hw/vnc/RFBGlue.cc
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
@@ -190,9 +190,12 @@ int vncIsTCPPortUsed(int port)
{
try {
// Attempt to create TCPListeners on that port.
- // They go out of scope immediately and are destroyed.
- std::list<network::TcpListener> dummy;
+ std::list<network::TcpListener*> dummy;
network::createTcpListeners (&dummy, 0, port);
+ while (!dummy.empty()) {
+ delete dummy.back();
+ dummy.pop_back();
+ }
} catch (rdr::Exception& e) {
return 1;
}
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 165afbb6..9b91d9a4 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -91,8 +91,8 @@ public:
XserverDesktop::XserverDesktop(int screenIndex_,
- std::list<network::TcpListener> listeners_,
- std::list<network::TcpListener> httpListeners_,
+ std::list<network::TcpListener*> listeners_,
+ std::list<network::TcpListener*> httpListeners_,
const char* name, const rfb::PixelFormat &pf,
int width, int height,
void* fbptr, int stride)
@@ -114,6 +114,14 @@ XserverDesktop::XserverDesktop(int screenIndex_,
XserverDesktop::~XserverDesktop()
{
+ while (!listeners.empty()) {
+ delete listeners.back();
+ listeners.pop_back();
+ }
+ while (!httpListeners.empty()) {
+ delete httpListeners.back();
+ httpListeners.pop_back();
+ }
if (!directFbptr)
delete [] data;
delete httpServer;
@@ -222,7 +230,7 @@ char* XserverDesktop::substitute(const char* varName)
}
if (strcmp(varName, "$PORT") == 0) {
char* str = new char[10];
- sprintf(str, "%d", listeners.empty () ? 0 : (*listeners.begin ()).getMyPort());
+ sprintf(str, "%d", listeners.empty () ? 0 : (*listeners.begin ())->getMyPort());
return str;
}
if (strcmp(varName, "$WIDTH") == 0) {
@@ -393,14 +401,14 @@ void XserverDesktop::readBlockHandler(fd_set* fds, struct timeval ** timeout)
// Add all sockets we want read events for, after purging
// any closed sockets.
- for (std::list<network::TcpListener>::iterator i = listeners.begin();
+ for (std::list<network::TcpListener*>::iterator i = listeners.begin();
i != listeners.end();
i++)
- FD_SET((*i).getFd(), fds);
- for (std::list<network::TcpListener>::iterator i = httpListeners.begin();
+ FD_SET((*i)->getFd(), fds);
+ for (std::list<network::TcpListener*>::iterator i = httpListeners.begin();
i != httpListeners.end();
i++)
- FD_SET((*i).getFd(), fds);
+ FD_SET((*i)->getFd(), fds);
std::list<Socket*> sockets;
std::list<Socket*>::iterator i;
@@ -456,24 +464,24 @@ void XserverDesktop::readWakeupHandler(fd_set* fds, int nfds)
// First check for file descriptors with something to do
if (nfds >= 1) {
- for (std::list<network::TcpListener>::iterator i = listeners.begin();
+ for (std::list<network::TcpListener*>::iterator i = listeners.begin();
i != listeners.end();
i++) {
- if (FD_ISSET((*i).getFd(), fds)) {
- FD_CLR((*i).getFd(), fds);
- Socket* sock = (*i).accept();
+ if (FD_ISSET((*i)->getFd(), fds)) {
+ FD_CLR((*i)->getFd(), fds);
+ Socket* sock = (*i)->accept();
sock->outStream().setBlocking(false);
server->addSocket(sock);
vlog.debug("new client, sock %d",sock->getFd());
}
}
- for (std::list<network::TcpListener>::iterator i = httpListeners.begin();
+ for (std::list<network::TcpListener*>::iterator i = httpListeners.begin();
i != httpListeners.end();
i++) {
- if (FD_ISSET((*i).getFd(), fds)) {
- FD_CLR((*i).getFd(), fds);
- Socket* sock = (*i).accept();
+ if (FD_ISSET((*i)->getFd(), fds)) {
+ FD_CLR((*i)->getFd(), fds);
+ Socket* sock = (*i)->accept();
sock->outStream().setBlocking(false);
httpServer->addSocket(sock);
vlog.debug("new http client, sock %d",sock->getFd());
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index 6909a766..c0690286 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -51,8 +51,8 @@ class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
public:
XserverDesktop(int screenIndex,
- std::list<network::TcpListener> listeners_,
- std::list<network::TcpListener> httpListeners_,
+ std::list<network::TcpListener*> listeners_,
+ std::list<network::TcpListener*> httpListeners_,
const char* name, const rfb::PixelFormat &pf,
int width, int height, void* fbptr, int stride);
virtual ~XserverDesktop();
@@ -113,8 +113,8 @@ private:
int screenIndex;
rfb::VNCServerST* server;
rfb::HTTPServer* httpServer;
- std::list<network::TcpListener> listeners;
- std::list<network::TcpListener> httpListeners;
+ std::list<network::TcpListener*> listeners;
+ std::list<network::TcpListener*> httpListeners;
bool deferredUpdateTimerSet;
bool directFbptr;
struct timeval dixTimeout;
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index d9f989a9..0ae55b6f 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -134,13 +134,13 @@ void vncExtensionInit(void)
for (int scr = 0; scr < vncGetScreenCount(); scr++) {
if (!desktop[scr]) {
- std::list<network::TcpListener> listeners;
- std::list<network::TcpListener> httpListeners;
+ std::list<network::TcpListener*> listeners;
+ std::list<network::TcpListener*> httpListeners;
if (scr == 0 && vncInetdSock != -1) {
if (network::TcpSocket::isSocket(vncInetdSock) &&
!network::TcpSocket::isConnected(vncInetdSock))
{
- listeners.push_back (network::TcpListener(vncInetdSock));
+ listeners.push_back(new network::TcpListener(vncInetdSock));
vlog.info("inetd wait");
}
} else {