Browse Source

Cleanup NetJack2 code.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4712 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.9.5
sletz 13 years ago
parent
commit
e1178e379c
2 changed files with 4 additions and 57 deletions
  1. +3
    -55
      common/JackNetInterface.cpp
  2. +1
    -2
      common/JackNetTool.cpp

+ 3
- 55
common/JackNetInterface.cpp View File

@@ -419,19 +419,6 @@ namespace Jack
int rx_bytes;

if (((rx_bytes = fSocket.Recv(fRxBuffer, size, flags)) == SOCKET_ERROR) && fRunning) {

/*
net_error_t error = fSocket.GetError();
// no data isn't really a network error, so just return 0 available read bytes
if (error == NET_NO_DATA) {
return 0;
} else if (error == NET_CONN_ERROR) {
FatalRecvError();
} else {
jack_error("Error in master receive : %s", StrError(NET_ERROR_CODE));
}
*/

FatalRecvError();
}

@@ -447,14 +434,6 @@ namespace Jack
PacketHeaderHToN(header, header);

if (((tx_bytes = fSocket.Send(fTxBuffer, size, flags)) == SOCKET_ERROR) && fRunning) {
/*
net_error_t error = fSocket.GetError();
if (error == NET_CONN_ERROR) {
FatalSendError();
} else {
jack_error("Error in master send : %s", StrError(NET_ERROR_CODE));
}
*/
FatalSendError();
}
return tx_bytes;
@@ -493,17 +472,6 @@ namespace Jack
int rx_bytes = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*>(fRxBuffer);

/*
int rx_bytes = Recv(fParams.fMtu, MSG_PEEK);

if ((rx_bytes == 0) || (rx_bytes == SOCKET_ERROR)) {
// 0 bytes considered an error (lost connection)
return SOCKET_ERROR;
}

fCurrentCycleOffset = fTxHeader.fCycle - rx_head->fCycle;
*/

// receive sync (launch the cycle)
do {
rx_bytes = Recv(fParams.fMtu, MSG_PEEK);
@@ -849,20 +817,9 @@ namespace Jack
int JackNetSlaveInterface::Recv(size_t size, int flags)
{
int rx_bytes = fSocket.Recv(fRxBuffer, size, flags);
// handle errors
if (rx_bytes == SOCKET_ERROR) {
/*
net_error_t error = fSocket.GetError();
// no data isn't really an error in realtime processing, so just return 0
if (error == NET_NO_DATA) {
jack_error("No data, is the master still running ?");
// if a network error occurs, this exception will restart the driver
} else if (error == NET_CONN_ERROR) {
FatalRecvError();
} else {
jack_error("Fatal error in slave receive : %s", StrError(NET_ERROR_CODE));
}
*/
FatalRecvError();
}

@@ -879,17 +836,9 @@ namespace Jack

// handle errors
if (tx_bytes == SOCKET_ERROR) {
/*
net_error_t error = fSocket.GetError();
// if a network error occurs, this exception will restart the driver
if (error == NET_CONN_ERROR) {
FatalSendError();
} else {
jack_error("Fatal error in slave send : %s", StrError(NET_ERROR_CODE));
}
*/
FatalSendError();
}
return tx_bytes;
}

@@ -897,8 +846,7 @@ namespace Jack
{
int rx_bytes = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*>(fRxBuffer);

// receive sync (launch the cycle)
do {
rx_bytes = Recv(fParams.fMtu, 0);


+ 1
- 2
common/JackNetTool.cpp View File

@@ -275,7 +275,7 @@ namespace Jack
*active_port_address = htonl(port_index);
active_port_address++;
active_ports++;
assert(active_ports < 256);
assert(active_ports < 256);
}
}

@@ -307,7 +307,6 @@ namespace Jack
// Count active ports
int active_ports = 0;
for (int port_index = 0; port_index < fNPorts; port_index++) {

if (fPortBuffer[port_index]) {
active_ports++;
}


Loading…
Cancel
Save