| 139 | |
| 140 | typedef bool handler_t(app_data_t* app, pn_event_t* event); |
| 141 | void run(pn_proactor_t *p, app_data_t *app, handler_t *shandler, handler_t *chandler) { |
| 142 | /* Loop and handle server/client events */ |
| 143 | do { |
| 144 | pn_event_batch_t *events = pn_proactor_wait(p); |
| 145 | pn_event_t *e; |
| 146 | for (e = pn_event_batch_next(events); e; e = pn_event_batch_next(events)) { |
| 147 | if (pn_event_type(e)==PN_PROACTOR_INACTIVE) { |
| 148 | return; |
| 149 | } |
| 150 | |
| 151 | if (pn_event_listener(e)) { |
| 152 | if (!shandler(app, e)) { |
| 153 | return; |
| 154 | } |
| 155 | } else { |
| 156 | if (!chandler(app, e)) { |
| 157 | return; |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | pn_proactor_done(p, events); |
| 162 | } while(true); |
| 163 | } |
| 164 | |
| 165 | static void run_until_listener_open(pn_proactor_t* p) { |
| 166 | do { |
no test coverage detected