Kaynağa Gözat

Make sure sockets are shutdown in java viewer listen mode

The finalizer method may not be strictly necessary but for the sake
of consistency shutdown the socket listener the same way we do for
a regular TcpSocket.
tags/v1.3.90
Brian P. Hinz 9 yıl önce
ebeveyn
işleme
12c3582306

+ 1
- 1
java/com/tigervnc/network/SocketListener.java Dosyayı Görüntüle

@@ -29,7 +29,7 @@ abstract public class SocketListener {
public SocketListener() {}

// shutdown() stops the socket from accepting further connections
abstract public void shutdown();
abstract public void shutdown() throws Exception;

// accept() returns a new Socket object if there is a connection
// attempt in progress AND if the connection passes the filter

+ 14
- 5
java/com/tigervnc/network/TcpListener.java Dosyayı Görüntüle

@@ -84,12 +84,21 @@ public class TcpListener extends SocketListener {
this(listenaddr, port, false, null, true);
}

// TcpListener::~TcpListener() {
// if (closeFd) closesocket(fd);
// }
protected void finalize() throws Exception {
if (closeFd)
try {
((SocketDescriptor)getFd()).close();
} catch (IOException e) {
throw new Exception(e.getMessage());
}
}

public void shutdown() {
//shutdown(getFd(), 2);
public void shutdown() throws Exception {
try {
((SocketDescriptor)getFd()).shutdown();
} catch (IOException e) {
throw new Exception(e.getMessage());
}
}

public TcpSocket accept() {

Loading…
İptal
Kaydet