From bf94bee63310d77f4ac341701d0fa513132dc992 Mon Sep 17 00:00:00 2001 From: sletz Date: Fri, 22 Jul 2011 20:15:42 +0000 Subject: [PATCH] More robust ActivePortsFromNetwork. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4501 0c269be4-1314-0410-8aa9-9f06e86f4224 --- common/JackNetInterface.cpp | 2 +- common/JackNetTool.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 45b9f507..d8562a05 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -477,7 +477,7 @@ namespace Jack int rx_bytes = Recv(fParams.fMtu, MSG_PEEK); if ((rx_bytes == 0) || (rx_bytes == SOCKET_ERROR)) { - // O bytes considered an error (lost connection) + // 0 bytes considered an error (lost connection) return SOCKET_ERROR; } diff --git a/common/JackNetTool.h b/common/JackNetTool.h index e78b4ea5..375aa376 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -637,7 +637,11 @@ namespace Jack for (uint port_index = 0; port_index < port_num; port_index++) { // Use -1 when port is actually connected on other side - fPortBuffer[*active_port_address] = (sample_t*)-1; + if (*active_port_address >= 0 && *active_port_address < fNPorts) { + fPortBuffer[*active_port_address] = (sample_t*)-1; + } else { + jack_error("ActivePortsFromNetwork: incorrect port = %d", *active_port_address); + } active_port_address++; } }