Commit 8c369f2b authored by Stephane Letz's avatar Stephane Letz
Browse files

Cleanup netjack2 code.

parent e7239f09
......@@ -415,17 +415,6 @@ struct JackNetExtMaster : public JackNetMasterInterface {
fNetMidiPlaybackBuffer->SetBuffer(midi_port_index, ((JackMidiBuffer**)midi_input_buffer)[midi_port_index]);
}
/*
// TODO : use with netmaster/netdriver code
//receive sync
int res = SyncRecv();
if ((res == 0) || (res == SOCKET_ERROR)) {
return res;
}
DecodeSyncPacket();
*/
int res = SyncRecv();
switch (res) {
......@@ -773,18 +762,8 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf
int Read()
{
// TODO : use with netmaster/netdriver code
//receive sync (launch the cycle)
/*
if (SyncRecv() == SOCKET_ERROR) {
return SOCKET_ERROR;
}
DecodeSyncPacket();
return DataRecv();
*/
switch (SyncRecv()) {
switch (SyncRecv()) {
case SOCKET_ERROR:
return SOCKET_ERROR;
......@@ -795,7 +774,6 @@ struct JackNetExtSlave : public JackNetSlaveInterface, public JackRunnableInterf
default:
//decode sync
//if there is an error, don't return -1, it will skip Write() and the network error probably won't be identified
DecodeSyncPacket();
break;
}
......
......@@ -349,18 +349,6 @@ namespace Jack
//read/write operations---------------------------------------------------------------
int JackNetAdapter::Read()
{
//don't return -1 in case of sync recv failure
//we need the process to continue for network error detection
/*
if (SyncRecv() == SOCKET_ERROR) {
return 0;
}
DecodeSyncPacket();
*/
//don't return -1 in case of sync recv failure
//we need the process to continue for network error detection
switch (SyncRecv()) {
case SOCKET_ERROR:
......
......@@ -521,21 +521,12 @@ namespace Jack
DecodeSyncPacket();
break;
}
/*
if (SyncRecv() == SOCKET_ERROR) {
return SOCKET_ERROR;
}
*/
#ifdef JACK_MONITOR
// For timing
fRcvSyncUst = GetMicroSeconds();
#endif
//decode sync
//if there is an error, don't return -1, it will skip Write() and the network error probably won't be identified
//DecodeSyncPacket();
#ifdef JACK_MONITOR
fNetTimeMon->Add(float(GetMicroSeconds() - fRcvSyncUst) / float(fEngineControl->fPeriodUsecs) * 100.f);
#endif
......@@ -550,15 +541,7 @@ namespace Jack
NotifyXRun(cur_time, float(cur_time - fBeginDateUst)); // Better this value than nothing...
break;
}
/*
if (res == SOCKET_ERROR) {
return SOCKET_ERROR;
} else if (res == NET_PACKET_ERROR) {
jack_time_t cur_time = GetMicroSeconds();
NotifyXRun(cur_time, float(cur_time - fBeginDateUst)); // Better this value than nothing...
}
*/
//take the time at the beginning of the cycle
JackDriver::CycleTakeBeginTime();
......
......@@ -489,6 +489,8 @@ namespace Jack
if (rx_head->fDataType != 's') {
jack_error("Wrong packet type : %c", rx_head->fDataType);
// Not the last packet..
fRxHeader.fIsLastPckt = 0;
return NET_PACKET_ERROR;
}
......@@ -509,10 +511,12 @@ namespace Jack
int rx_bytes = 0;
uint recvd_midi_pckt = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*>(fRxBuffer);
while (!fRxHeader.fIsLastPckt) {
// how much data is queued on the rx buffer ?
rx_bytes = Recv(fParams.fMtu, MSG_PEEK);
//jack_error("DataRecv : rx_bytes %d", rx_bytes);
// error here, problem with recv, just skip the cycle (return -1)
if (rx_bytes == SOCKET_ERROR) {
......@@ -875,6 +879,8 @@ namespace Jack
if (rx_head->fDataType != 's') {
jack_error("Wrong packet type : %c", rx_head->fDataType);
// Not the last packet...
fRxHeader.fIsLastPckt = 0;
return NET_PACKET_ERROR;
}
......
......@@ -510,13 +510,6 @@ namespace Jack
}
//receive sync
/*
int res = SyncRecv();
if ((res == 0) || (res == SOCKET_ERROR)) {
return res;
}
*/
int res = SyncRecv();
switch (res) {
......@@ -526,7 +519,7 @@ namespace Jack
case NET_PACKET_ERROR:
// Since sync packet is incorrect, don't decode it and continue with data
break;
break;
default:
//decode sync
......@@ -537,21 +530,7 @@ namespace Jack
#ifdef JACK_MONITOR
fNetTimeMon->Add((((float)(GetMicroSeconds() - begin_time)) / (float) fPeriodUsecs) * 100.f);
#endif
//decode sync
//DecodeSyncPacket();
//receive data
/*
res = DataRecv();
if ((res == 0) || (res == SOCKET_ERROR)) {
return res;
} else if (res == NET_PACKET_ERROR) {
// Well not a real XRun...
JackServerGlobals::fInstance->GetEngine()->NotifyClientXRun(ALL_CLIENTS);
}
*/
//receive data
res = DataRecv();
switch (res) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment