mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-377: Set NO_DELAY on guacd socket to avoid unnecessary latency.
This commit is contained in:
@@ -34,6 +34,7 @@ import java.io.OutputStreamWriter;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
|
import java.net.StandardSocketOptions;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
import org.apache.guacamole.GuacamoleUpstreamTimeoutException;
|
import org.apache.guacamole.GuacamoleUpstreamTimeoutException;
|
||||||
@@ -102,6 +103,10 @@ public class InetGuacamoleSocket implements GuacamoleSocket {
|
|||||||
// Set read timeout
|
// Set read timeout
|
||||||
sock.setSoTimeout(SOCKET_TIMEOUT);
|
sock.setSoTimeout(SOCKET_TIMEOUT);
|
||||||
|
|
||||||
|
// Set TCP_NODELAY to avoid any latency that would otherwise be
|
||||||
|
// added by the networking stack and Nagle's algorithm
|
||||||
|
sock.setTcpNoDelay(true);
|
||||||
|
|
||||||
// On successful connect, retrieve I/O streams
|
// On successful connect, retrieve I/O streams
|
||||||
reader = new ReaderGuacamoleReader(new InputStreamReader(sock.getInputStream(), "UTF-8"));
|
reader = new ReaderGuacamoleReader(new InputStreamReader(sock.getInputStream(), "UTF-8"));
|
||||||
writer = new WriterGuacamoleWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8"));
|
writer = new WriterGuacamoleWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8"));
|
||||||
|
Reference in New Issue
Block a user