Commit 8b0e453d authored by sletz's avatar sletz
Browse files

Add InitConnection and InitRendering methods in JackNetSlaveInterface, better...

Add InitConnection and InitRendering methods in JackNetSlaveInterface, better packet type checking in JackNetSlaveInterface::SyncRecv.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3329 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 22fe6da4
......@@ -22,6 +22,10 @@ Michael Voigt
---------------------------
Jackdmp changes log
---------------------------
2009-02-20 Stephane Letz <letz@grame.fr>
* Add InitConnection and InitRendering methods in JackNetSlaveInterface, better packet type checking in JackNetSlaveInterface::SyncRecv.
2009-02-17 Stephane Letz <letz@grame.fr>
......
......@@ -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;
}
......
......@@ -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();
......
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