diff --git a/ChangeLog b/ChangeLog index d00073ee..b36a1d78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ Michael Voigt --------------------------- Jackdmp changes log --------------------------- + +2009-02-20 Stephane Letz + + * Add InitConnection and InitRendering methods in JackNetSlaveInterface, better packet type checking in JackNetSlaveInterface::SyncRecv. 2009-02-17 Stephane Letz diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index fb1c2fea..37faaa9a 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -597,6 +597,48 @@ namespace Jack return true; } + + // Separate the connection protocol into two separated step + + bool JackNetSlaveInterface::InitConnection() + { + jack_log ( "JackNetSlaveInterface::InitConnection()" ); + + //set the parameters to send + strcpy (fParams.fPacketType, "params"); + fParams.fProtocolVersion = SLAVE_PROTOCOL; + SetPacketType (&fParams, SLAVE_AVAILABLE); + + net_status_t status; + do + { + //get a master + status = GetNetMaster(); + if (status == NET_SOCKET_ERROR) + return false; + } + while (status != NET_CONNECTED); + + return true; + } + + bool JackNetSlaveInterface::InitRendering() + { + jack_log("JackNetSlaveInterface::InitRendering()"); + + net_status_t status; + do + { + //then tell the master we are ready + jack_info("Initializing connection with %s...", fParams.fMasterNetName); + status = SendStartToMaster(); + if (status == NET_ERROR) + return false; + } + while (status != NET_ROLLING); + + return true; + } net_status_t JackNetSlaveInterface::GetNetMaster() { @@ -760,7 +802,8 @@ namespace Jack if ( rx_bytes == SOCKET_ERROR ) return rx_bytes; } - while ( !rx_bytes && ( rx_head->fDataType != 's' ) ); + while ((strcmp(rx_head->fPacketType, "header") != 0) && (rx_head->fDataType != 's')); + fRxHeader.fIsLastPckt = rx_head->fIsLastPckt; return rx_bytes; } diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index c4c0c720..eaf0a3ef 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -140,6 +140,8 @@ namespace Jack net_transport_data_t fReturnTransportData; bool Init(); + bool InitConnection(); + bool InitRendering(); net_status_t GetNetMaster(); net_status_t SendStartToMaster();