Skip to content

Commit 997e313

Browse files
author
Dorian Birraux
committed
Finer control over version and available functions
Fix a backward incompatibilities between incoming 12.1 paclet and 1.1.1 wolframclient.
1 parent c5d5440 commit 997e313

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

wolframclient/evaluation/kernel/initkernel.m

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ no matter the total size (tested with 80MB) *)
2121

2222
Begin["`Private`"];
2323

24+
2425
(*Define the most efficient pair of write bytearray and non-blocking read, for various WL versions. *)
25-
{SocketWriteByteArrayFunc, SocketReadByteArrayFuncNoWait} = If[
26+
{SocketWriteByteArrayFunc, SocketReadByteArrayFuncNoWait} = Which[
2627
$VersionNumber < 12,
2728
{
2829
Function[{socketOut, ba}, ZeroMQLink`Private`ZMQWriteInternal[socketOut, Normal[ba]]],
@@ -32,13 +33,23 @@ no matter the total size (tested with 80MB) *)
3233
If[Length[data] >= 3, Part[data,4;;], {}]
3334
]
3435
]
35-
}
36+
},
37+
$VersionNumber < 12.1,
38+
{
39+
Function[{socketOut, ba}, ZMQSocketWriteMessage[socketOut, ba]],
40+
Function[{socketIn},
41+
Block[
42+
{data = iRecvSingleMultipartBinaryMessageSocket[First@socketIn, 1(*Flag NOWAIT*)]},
43+
If[Length[data] >= 3, Part[data,4;;], {}]
44+
]
45+
]
46+
},
47+
True
3648
,
3749
{
3850
ZMQSocketWriteMessage,
3951
SocketReadMessage[#, "Blocking"->False] &
4052
}
41-
4253
];
4354

4455
$DEBUG=1;

0 commit comments

Comments
 (0)