Changeset da4a6eb2a1588a437c77eee59f27a181876f0eeb
- Timestamp:
- 12/27/10 15:34:35 (2 years ago)
- Author:
- Nedko Arnaudov <nedko@…>
- Children:
- eeaa82d17170e394c90099b17ec0f2b4a2998734
- Parents:
- 3a5b7037d88ca19b2003cba39fa7a4ed2bbfae0c
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-12-27T15:34:35Z+0200
- Message:
-
ladishd: save hidden porst of stopped apps.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r9868de4
|
rda4a6eb
|
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | | static bool is_app_running(ladish_app_supervisor_handle app_supervisor, ladish_port_handle port) |
| | 48 | static bool is_hidden_port_interesting(ladish_app_supervisor_handle app_supervisor, ladish_client_handle client, ladish_port_handle port) |
| 49 | 49 | { |
| 50 | 50 | uuid_t app_uuid; |
| 51 | 51 | ladish_app_handle app; |
| 52 | 52 | |
| | 53 | if (is_system_client(client) || ladish_port_is_link(port)) |
| | 54 | { |
| | 55 | return true; |
| | 56 | } |
| | 57 | |
| | 58 | /* hidden ports of external apps should not be saved */ |
| | 59 | /* hidden ports of stopped managed apps should be saved */ |
| | 60 | /* hidden ports of started managed apps should not be saved */ |
| | 61 | |
| 53 | 62 | if (!ladish_port_get_app(port, app_uuid)) |
| 54 | 63 | { |
| | 64 | /* port of external app, don't save */ |
| 55 | 65 | return false; |
| 56 | 66 | } |
| … |
… |
|
| 59 | 69 | if (app == NULL) |
| 60 | 70 | { |
| 61 | | return false; |
| 62 | | } |
| 63 | | |
| 64 | | return ladish_app_is_running(app); |
| 65 | | } |
| 66 | | |
| 67 | | #define is_port_interesting(app_supervisor, client, port) ( \ |
| 68 | | is_app_running(app_supervisor, port) || \ |
| 69 | | ladish_port_is_link(port) || \ |
| 70 | | is_system_client(client)) |
| | 71 | ASSERT_NO_PASS; /* this should not happen because app ports are removed before app is removed */ |
| | 72 | return false; |
| | 73 | } |
| | 74 | |
| | 75 | return !ladish_app_is_running(app); |
| | 76 | } |
| 71 | 77 | |
| 72 | 78 | bool ladish_write_string(int fd, const char * string) |
| … |
… |
|
| 489 | 495 | |
| 490 | 496 | /* skip hidden ports of running apps */ |
| 491 | | if (hidden && !is_port_interesting(ctx_ptr->app_supervisor, client_handle, port_handle)) |
| | 497 | if (hidden && !is_hidden_port_interesting(ctx_ptr->app_supervisor, client_handle, port_handle)) |
| 492 | 498 | { |
| 493 | 499 | return true; |
| … |
… |
|
| 604 | 610 | |
| 605 | 611 | if (hidden && |
| 606 | | (!is_port_interesting(ctx_ptr->app_supervisor, client1, port1) || |
| 607 | | !is_port_interesting(ctx_ptr->app_supervisor, client2, port2))) |
| | 612 | (!is_hidden_port_interesting(ctx_ptr->app_supervisor, client1, port1) || |
| | 613 | !is_hidden_port_interesting(ctx_ptr->app_supervisor, client2, port2))) |
| 608 | 614 | { |
| 609 | 615 | return true; |
| … |
… |
|
| 1002 | 1008 | |
| 1003 | 1009 | /* skip hidden ports of running apps */ |
| 1004 | | if (hidden && !is_port_interesting(ctx_ptr->app_supervisor, client_handle, port_handle)) |
| | 1010 | if (hidden && !is_hidden_port_interesting(ctx_ptr->app_supervisor, client_handle, port_handle)) |
| 1005 | 1011 | { |
| 1006 | 1012 | return true; |