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; int rx_bytes;


if (((rx_bytes = fSocket.Recv(fRxBuffer, size, flags)) == SOCKET_ERROR) && fRunning) { 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(); FatalRecvError();
} }


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


if (((tx_bytes = fSocket.Send(fTxBuffer, size, flags)) == SOCKET_ERROR) && fRunning) { 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(); FatalSendError();
} }
return tx_bytes; return tx_bytes;
@@ -493,17 +472,6 @@ namespace Jack
int rx_bytes = 0; int rx_bytes = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*>(fRxBuffer); 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) // receive sync (launch the cycle)
do { do {
rx_bytes = Recv(fParams.fMtu, MSG_PEEK); rx_bytes = Recv(fParams.fMtu, MSG_PEEK);
@@ -849,20 +817,9 @@ namespace Jack
int JackNetSlaveInterface::Recv(size_t size, int flags) int JackNetSlaveInterface::Recv(size_t size, int flags)
{ {
int rx_bytes = fSocket.Recv(fRxBuffer, size, flags); int rx_bytes = fSocket.Recv(fRxBuffer, size, flags);
// handle errors // handle errors
if (rx_bytes == SOCKET_ERROR) { 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(); FatalRecvError();
} }


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


// handle errors // handle errors
if (tx_bytes == SOCKET_ERROR) { 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(); FatalSendError();
} }
return tx_bytes; return tx_bytes;
} }


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

// receive sync (launch the cycle) // receive sync (launch the cycle)
do { do {
rx_bytes = Recv(fParams.fMtu, 0); 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 = htonl(port_index);
active_port_address++; active_port_address++;
active_ports++; active_ports++;
assert(active_ports < 256);
assert(active_ports < 256);
} }
} }


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

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


Loading…
Cancel
Save