Closed raacampbell closed 11 months ago
With a68ebd4cf299acb94911449b93f269de623f6ec0 we implement the Quick Fix. This commit is totally untested.
Above didn't work so revert it and work on the ideal solution 3af409ddd5c1407bea2e73085f2055e5ca563ed8
Here we do not block. We stop
the task if a finite acq task already exists instead of connecting to the DAQ. We don't run sendSamples if finite samples are already being produced.
This works
Problem
When the client calls
TCPclient.sendSamples
with a finite stimulus, it waits (is blocked) byzapit.pointer.sendSamples
(on the server) to finish before it returns. This is a problem because it means the user can not then trigger a trial because the MATLAB session on the client is blocked. The reason this happens is because the client waits for a TCP/IP reply that can't be sent untilzapit.pointer.sendSamples
has finished.Quick Fix
The fastest fix is to send back the response before
zapit.pointer.sendSamples
has run. We simply will not return the stimulus identity and laser state. This likely won't matter as it's only a concern if the user is expecting these values to be assigned manually byzapit.pointer.sendSamples
and needs to know what they were on the client.Quick Fix Followup
We can follow on from the above by feeding the last laser state and last condition number into a property that is read off by
processBufferMessageCallback
instead of waiting forsendSamples
to complete. This is easy enough to do.Ideal Solution
The big problem with the above is that the problem must extend to the local MATLAB session and so the above fix only helps if the user is on TCP/IP. Further, the solution does not stop the client from sending messages to the server even when the server is in a blocked state. The server will fail to respond and that too will block the client. This is unlikely to be a concern in practice but we could avoid all this mess by having
zapit.pointer.sendSamples
be non-blocking and instead have routines to check if a stimulus is currently being presented and, if not, to stop the DAQ task before setting up the next stimulus. This will need investigation so for now we proceed with the quicker fixses.