somewhere

This commit is contained in:
Dhanya Maliakal 2017-11-23 14:53:37 +01:00
parent 856ad76247
commit 8538604c0f

View File

@ -3694,14 +3694,12 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
// disable data streaming before changing zmq port (but only if they were on) // disable data streaming before changing zmq port (but only if they were on)
int prev_streaming = 0; int prev_streaming = 0;
switch (p) { switch (p) {
case RECEIVER_STREAMING_PORT:
prev_streaming = enableDataStreamingFromReceiver();
enableDataStreamingFromReceiver(0);
enableDataStreamingToClient(0);
break;
case CLIENT_STREAMING_PORT: case CLIENT_STREAMING_PORT:
prev_streaming = enableDataStreamingToClient(); prev_streaming = enableDataStreamingToClient();
enableDataStreamingToClient(0); enableDataStreamingToClient(0);
break;
case RECEIVER_STREAMING_PORT:
prev_streaming = enableDataStreamingFromReceiver();
enableDataStreamingFromReceiver(0); enableDataStreamingFromReceiver(0);
break; break;
default: break; default: break;
@ -3763,12 +3761,10 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
//enable data streaming if it was on //enable data streaming if it was on
if (prev_streaming) { if (prev_streaming) {
switch (p) { switch (p) {
case RECEIVER_STREAMING_PORT:
enableDataStreamingFromReceiver(1);
enableDataStreamingToClient(1);
break;
case CLIENT_STREAMING_PORT: case CLIENT_STREAMING_PORT:
enableDataStreamingToClient(1); enableDataStreamingToClient(1);
break;
case RECEIVER_STREAMING_PORT:
enableDataStreamingFromReceiver(1); enableDataStreamingFromReceiver(1);
break; break;
default: break; default: break;
@ -5812,6 +5808,8 @@ void multiSlsDetector::readFrameFromReceiver(){
int nch; int nch;
bool runningList[numSockets]; bool runningList[numSockets];
bool connectList[numSockets];
int numRunning = 0; int numRunning = 0;
//wait for real time acquisition to start //wait for real time acquisition to start
@ -5820,8 +5818,17 @@ void multiSlsDetector::readFrameFromReceiver(){
if(checkJoinThread()) if(checkJoinThread())
running = false; running = false;
for(int i = 0; i < numSockets; ++i) for(int i = 0; i < numSockets; ++i) {
if(!zmqSocket[i]->Connect()) {
connectList[i] = true;
runningList[i] = true; runningList[i] = true;
} else {
connectList[i] = false;
cprintf(RED,"Error: Could not connect to socket %s\n",zmqSocket[i]->GetZmqServerAddress());
runningList[i] = false;
}
}
numRunning = numSockets; numRunning = numSockets;
@ -5904,6 +5911,11 @@ void multiSlsDetector::readFrameFromReceiver(){
running = true; running = true;
} }
// Disconnect resources
for (int i = 0; i < numSockets; ++i)
if (connectList[i])
zmqSocket[i]->Disconnect();
//free resources //free resources
delete [] image; delete [] image;
delete[] multiframe; delete[] multiframe;