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,8 +100,15 @@ Mixer::reply_to_finger ( lo_message msg )
int argc = lo_message_get_argc( msg ); int argc = lo_message_get_argc( msg );
lo_arg **argv = lo_message_get_argv( msg ); lo_arg **argv = lo_message_get_argv( msg );
if ( argc < 1 ) if ( argc >= 4 )
return; {
const char *url = &argv[0]->s;
const char *name = &argv[1]->s;
const char *version = &argv[2]->s;
const char *id = &argv[3]->s;
MESSAGE( "Discovered NON peer %s (%s) @ %s with ID \"%s\"", name, version, url, id );
MESSAGE( "Registering Signals" );
lo_address to = lo_address_new_from_url( &argv[0]->s ); lo_address to = lo_address_new_from_url( &argv[0]->s );
@ -112,7 +119,10 @@ Mixer::reply_to_finger ( lo_message msg )
VERSION, VERSION,
instance_name ); instance_name );
mixer->osc_endpoint->hello( url );
lo_address_free( to ); lo_address_free( to );
}
} }
void void

View File

@ -43,7 +43,7 @@ NSM_Client::command_broadcast ( const char *path, lo_message msg )
int argc = lo_message_get_argc( msg ); int argc = lo_message_get_argc( msg );
// lo_arg **argv = lo_message_get_argv( 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 ); mixer->reply_to_finger( msg );
return 0; return 0;

View File

@ -285,6 +285,8 @@ main ( int argc, char **argv )
} }
} }
mixer->say_hello();
Fl::add_check( check_sigterm ); Fl::add_check( check_sigterm );
Fl::run(); 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 ); int argc = lo_message_get_argc( msg );
// lo_arg **argv = lo_message_get_argv( 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 ); timeline->reply_to_finger( msg );
return 0; return 0;

View File

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