Lines Matching defs:app

140 	// We only send the "app registered" message upon success,
141 // so if anything goes wrong here, we do not let the app
143 // likely, the app is dead. If not, it freezes forever
146 app_t* app = new app_t;
148 if (msg->FindMessenger("midi:messenger", &app->messenger) == B_OK
149 && _SendAllEndpoints(app)
150 && _SendAllConnections(app)) {
154 if (_SendNotification(app, &reply)) {
155 fApps.AddItem(app);
163 delete app;
175 endpoint->app = _WhichApp(msg);
176 if (endpoint->app == NULL) {
205 if (_SendReply(endpoint->app, msg, &reply) && status == B_OK)
222 app_t* app = _WhichApp(msg);
223 if (app != NULL) {
224 endpoint_t* endpoint = _WhichEndpoint(msg, app);
226 _RemoveEndpoint(app, endpoint);
238 // itself, so we don't check that the app that made the
261 app_t* app = _WhichApp(msg);
262 if (app == NULL)
265 endpoint = _WhichEndpoint(msg, app);
275 if (_SendReply(app, msg, &reply) && status == B_OK) {
306 _NotifyAll(&notify, app);
326 app_t* app = _WhichApp(msg);
327 if (app == NULL)
357 if (_SendReply(app, msg, &reply) && status == B_OK) {
372 _NotifyAll(&notify, app);
381 /*! Sends an app MSG_ENDPOINT_CREATED notifications for
382 all current endpoints. Used when the app registers.
385 MidiServerApp::_SendAllEndpoints(app_t* app)
387 ASSERT(app != NULL)
396 if (!_SendNotification(app, &notify))
404 /*! Sends an app MSG_ENDPOINTS_CONNECTED notifications for
405 all current connections. Used when the app registers.
408 MidiServerApp::_SendAllConnections(app_t* app)
410 ASSERT(app != NULL)
422 if (!_SendNotification(app, &notify))
448 _NotifyAll(&notify, endpoint->app);
457 other apps about this event. "app" is the application
458 that the endpoint belongs to; if it is NULL, the app
462 MidiServerApp::_RemoveEndpoint(app_t* app, endpoint_t* endpoint)
477 _NotifyAll(&notify, app);
561 app_t* app = _AppAt(t);
562 if (app->messenger.Team() == retadr.Team())
563 return app;
574 checks whether the application specified by "app" really
578 MidiServerApp::_WhichEndpoint(BMessage* msg, app_t* app)
581 ASSERT(app != NULL)
586 if (endpoint != NULL && endpoint->app == app)
590 TRACE(("Endpoint not found or wrong app"))
616 The "except" app is allowed to be NULL.
624 app_t* app = _AppAt(t);
625 if (app != except && !_SendNotification(app, msg)) {
640 MidiServerApp::_SendNotification(app_t* app, BMessage* msg)
642 ASSERT(app != NULL)
645 status_t status = app->messenger.SendMessage(msg, (BHandler*) NULL,
648 _DeliveryError(app);
655 If "app" is NULL, the application is not registered
659 MidiServerApp::_SendReply(app_t* app, BMessage* msg, BMessage* reply)
665 if (status != B_OK && app != NULL) {
666 _DeliveryError(app);
667 fApps.RemoveItem(app);
668 delete app;
679 /*! Removes an app and all of its endpoints from the roster
685 MidiServerApp::_DeliveryError(app_t* app)
687 ASSERT(app != NULL)
689 // We cannot communicate with the app, so we assume it's
695 // of an app as a separate event, and pretend that the
696 // now-dead app sent us delete requests for its endpoints.
698 TRACE(("Delivery error; unregistering app (%p)", app))
704 if (endpoint->app == app) {
786 app_t* app = _AppAt(t);
788 printf("\tapp %" B_PRId32 " (%p): team %" B_PRId32 "\n", t, app,
789 app->messenger.Team());
805 printf("\t\tid %" B_PRId32 ", name '%s', %s, %s, app %p\n",
809 endpoint->app);
836 MidiServerApp app(status);
839 app.Run();