Tweak Timeline<->Mixer discovery handshake.

This commit is contained in:
Jonathan Moore Liles 2012-06-18 21:25:41 -07:00
parent 8cddccf6a4
commit a480a93ba4
5 changed files with 34 additions and 18 deletions

View File

@ -100,19 +100,29 @@ Mixer::reply_to_finger ( lo_message msg )
int argc = lo_message_get_argc( msg );
lo_arg **argv = lo_message_get_argv( msg );
if ( argc < 1 )
return;
if ( argc >= 4 )
{
const char *url = &argv[0]->s;
const char *name = &argv[1]->s;
const char *version = &argv[2]->s;
const char *id = &argv[3]->s;
lo_address to = lo_address_new_from_url( &argv[0]->s );
MESSAGE( "Discovered NON peer %s (%s) @ %s with ID \"%s\"", name, version, url, id );
MESSAGE( "Registering Signals" );
osc_endpoint->send( to,
"/non/hello",
osc_endpoint->url(),
APP_NAME,
VERSION,
instance_name );
lo_address_free( to );
lo_address to = lo_address_new_from_url( &argv[0]->s );
osc_endpoint->send( to,
"/non/hello",
osc_endpoint->url(),
APP_NAME,
VERSION,
instance_name );
mixer->osc_endpoint->hello( url );
lo_address_free( to );
}
}
void

View File

@ -43,7 +43,7 @@ NSM_Client::command_broadcast ( const char *path, lo_message msg )
int argc = lo_message_get_argc( msg );
// lo_arg **argv = lo_message_get_argv( msg );
if ( argc == 1 && !strcmp( path, "/non/finger" ) )
if ( !strcmp( path, "/non/hello" ) )
{
mixer->reply_to_finger( msg );
return 0;

View File

@ -285,6 +285,8 @@ main ( int argc, char **argv )
}
}
mixer->say_hello();
Fl::add_check( check_sigterm );
Fl::run();

View File

@ -99,7 +99,7 @@ command_broadcast ( const char *path, lo_message msg, void *userdata )
int argc = lo_message_get_argc( msg );
// lo_arg **argv = lo_message_get_argv( msg );
if ( argc == 1 && !strcmp( path, "/non/finger" ) )
if ( !strcmp( path, "/non/hello" ) )
{
timeline->reply_to_finger( msg );
return 0;

View File

@ -1755,6 +1755,8 @@ Timeline::reply_to_finger ( lo_message msg )
VERSION,
instance_name );
osc->hello( &argv[0]->s );
lo_address_free( reply );
}
@ -1787,12 +1789,14 @@ Timeline::discover_peers ( void )
{
lo_message m = lo_message_new();
lo_message_add_string( m, "/non/finger" );
lo_message_add_string( m, osc->url() );
nsm_send_broadcast( nsm, m );
lo_message_add( m, "sssss",
"/non/hello",
osc->url(),
APP_NAME,
VERSION,
instance_name );
lo_message_free( m );
nsm_send_broadcast( nsm, m );
}
}