@@ -182,9 +182,9 @@ public VncVal apply(final VncList args) {
182182 ? 0
183183 : Coerce .toVncLong (maxConnVal ).getIntValue ();
184184
185- final long maxMsgSize = convertMaxMessageSizeToLong (maxMsgSizeVal );
186- final long maxQueues = convertMaxMessageSizeToLong (maxMaxQueuesVal );
187- final long compressCutoffSize = convertMaxMessageSizeToLong (compressCutoffSizeVal );
185+ final long maxMsgSize = convertUnitValueToLong (maxMsgSizeVal );
186+ final long maxQueues = convertUnitValueToLong (maxMaxQueuesVal );
187+ final long compressCutoffSize = convertUnitValueToLong (compressCutoffSizeVal );
188188 final boolean encrypt = Coerce .toVncBoolean (encryptVal ).getValue ();
189189
190190 final File serverLogDir = serverLogDirVal == Nil
@@ -297,13 +297,6 @@ public VncVal apply(final VncList args) {
297297 "| port p | The server's TCP/IP port |\n " +
298298 "| host h | The server's TCP/IP host |\n \n " +
299299 "*Options:* \n \n " +
300- "| :compress-cutoff-size n | The compression cutoff size for payload messages.¶" +
301- " With a negative cutoff size payload messages will not be" +
302- " compressed. If the payload message size is greater than the" +
303- " cutoff size it will be compressed.¶" +
304- " Defaults to -1 (no compression)¶" +
305- " The cutoff size can be specified as a number like `1000`" +
306- " or a number with a unit like `:1KB` or `:2MB`|\n " +
307300 "| :encrypt b | If `true` encrypt the payload data of all messages exchanged" +
308301 " between this client and its associated server.¶" +
309302 " The data is AES-256-GCM encrypted using a secret that is" +
@@ -325,7 +318,7 @@ public VncVal apply(final VncList args) {
325318 " \n " +
326319 " (try-with [server (ipc/server 33333 echo-handler) \n " +
327320 " client-1 (ipc/client 33333) \n " +
328- " client-2 (ipc/client \" localhost\" 33333 :compress-cutoff-size 0) \n " +
321+ " client-2 (ipc/client \" localhost\" 33333) \n " +
329322 " client-3 (ipc/client :localhost 33333 :encrypt true)] \n " +
330323 " (send client-1 (ipc/plain-text-message \" 1\" \" test\" \" hello\" )) \n " +
331324 " (send client-2 (ipc/plain-text-message \" 2\" \" test\" \" hello\" )) \n " +
@@ -378,20 +371,14 @@ else if ( args.size() == 2) {
378371 final int port = Coerce .toVncLong (args .second ()).getIntValue ();
379372
380373 final VncHashMap options = VncHashMap .ofAll (args .slice (2 ));
381- final VncVal compressCutoffSizeVal = options .get (new VncKeyword ("compress-cutoff-size" ));
382374 final VncVal encryptVal = options .get (new VncKeyword ("encrypt" ), VncBoolean .False );
383375
384- final long compressCutoffSize = convertMaxMessageSizeToLong (compressCutoffSizeVal );
385376 final boolean encrypt = Coerce .toVncBoolean (encryptVal ).getValue ();
386377
387378 final TcpClient client = new TcpClient (host , port );
388379
389380 client .setEncryption (encrypt );
390381
391- if (compressCutoffSize >= 0 ) {
392- client .setCompressCutoffSize (compressCutoffSize );
393- }
394-
395382 client .open ();
396383
397384 return new VncJavaObject (client );
@@ -2897,7 +2884,7 @@ public VncVal apply(final VncList args) {
28972884 // Utils
28982885 // ------------------------------------------------------------------------
28992886
2900- private static long convertMaxMessageSizeToLong (final VncVal val ) {
2887+ private static long convertUnitValueToLong (final VncVal val ) {
29012888 if (val == Nil ) {
29022889 return 0L ;
29032890 }
@@ -2916,11 +2903,11 @@ else if (sVal.matches("^[1-9][0-9]*MB$")) {
29162903 return Long .parseLong (StringUtil .removeEnd (sVal , "MB" )) * 1024 * 1024 ;
29172904 }
29182905 else {
2919- throw new VncException ("Invalid max-message-size value! Use 20000, 500KB, 10MB, ..." );
2906+ throw new VncException ("Invalid unit value! Use 20000, 500KB, 10MB, ..." );
29202907 }
29212908 }
29222909 else {
2923- throw new VncException ("Invalid max-message-size value! Use 20000, 500KB, 10MB, ..." );
2910+ throw new VncException ("Invalid unit value! Use 20000, 500KB, 10MB, ..." );
29242911 }
29252912 }
29262913
0 commit comments