NSM: Give clients a 5 second period in which to announce themselves--otherwise assume they are dumb clients.
This commit is contained in:
parent
5adba898ef
commit
4ef20c0f71
|
@ -474,19 +474,6 @@ get_client_by_address ( lo_address addr )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
replies_still_pending ( )
|
|
||||||
{
|
|
||||||
for ( std::list<Client*>::const_iterator i = client.begin();
|
|
||||||
i != client.end();
|
|
||||||
++i )
|
|
||||||
if ( (*i)->active && (*i)->reply_pending() )
|
|
||||||
return true;
|
|
||||||
/* if ( (*i)->reply_pending() ) */
|
|
||||||
/* return true; */
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
generate_client_id ( Client *c )
|
generate_client_id ( Client *c )
|
||||||
|
@ -502,20 +489,68 @@ generate_client_id ( Client *c )
|
||||||
return strdup(id_str);
|
return strdup(id_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
replies_still_pending ( void )
|
||||||
|
{
|
||||||
|
for ( std::list<Client*>::const_iterator i = client.begin();
|
||||||
|
i != client.end();
|
||||||
|
++i )
|
||||||
|
if ( (*i)->active && (*i)->reply_pending() )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
number_of_active_clients ( void )
|
||||||
|
{
|
||||||
|
int active = 0;
|
||||||
|
for ( std::list<Client*>::const_iterator i = client.begin(); i != client.end(); i++ )
|
||||||
|
{
|
||||||
|
if ( (*i)->active )
|
||||||
|
active++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return active;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wait_for_replies ( )
|
wait_for_announce ( void )
|
||||||
{
|
{
|
||||||
fprintf( stdout, "Waiting..." );
|
MESSAGE( "Waiting for announce messages from clients" );
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
int n = 7;
|
int n = 5 * 1000;
|
||||||
|
|
||||||
while ( n-- )
|
int active;
|
||||||
|
|
||||||
|
while ( n > 0 )
|
||||||
{
|
{
|
||||||
printf( "." );
|
n -= 100;
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
osc_server->wait( 1000 );
|
osc_server->wait(100);
|
||||||
|
|
||||||
|
active = number_of_active_clients();
|
||||||
|
|
||||||
|
if ( client.size() == active )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
MESSAGE( "Done. %i out of %i clients announced within the initialization grace period", active, client.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wait_for_replies ( void )
|
||||||
|
{
|
||||||
|
MESSAGE( "Waiting for clients to reply to commands" );
|
||||||
|
|
||||||
|
int n = 60 * 1000; /* 60 seconds */
|
||||||
|
|
||||||
|
while ( n )
|
||||||
|
{
|
||||||
|
n -= 100;
|
||||||
|
|
||||||
|
osc_server->wait(100);
|
||||||
|
|
||||||
if ( ! replies_still_pending() )
|
if ( ! replies_still_pending() )
|
||||||
break;
|
break;
|
||||||
|
@ -1229,7 +1264,10 @@ load_session_file ( const char * path )
|
||||||
* messages immediately, even if no replies seem to be pending
|
* messages immediately, even if no replies seem to be pending
|
||||||
* yet. */
|
* yet. */
|
||||||
|
|
||||||
// osc_server->wait( 3000 );
|
/* dumb clients will never send an 'announce message', so we need
|
||||||
|
* to give up waiting on them fairly soon. */
|
||||||
|
|
||||||
|
wait_for_announce();
|
||||||
|
|
||||||
wait_for_replies();
|
wait_for_replies();
|
||||||
|
|
||||||
|
@ -1735,7 +1773,7 @@ OSC_HANDLER( progress )
|
||||||
{
|
{
|
||||||
c->progress = argv[0]->f;
|
c->progress = argv[0]->f;
|
||||||
|
|
||||||
MESSAGE( "%s progress: %i%%", c->name, (int)(c->progress * 100.0f) );
|
/* MESSAGE( "%s progress: %i%%", c->name, (int)(c->progress * 100.0f) ); */
|
||||||
|
|
||||||
if ( gui_is_active )
|
if ( gui_is_active )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue