| 337 | } |
| 338 | |
| 339 | static void |
| 340 | stats_process_read(TSCont contp, TSEvent event, stats_state *my_state) |
| 341 | { |
| 342 | Dbg(dbg_ctl, "stats_process_read(%d)", event); |
| 343 | if (event == TS_EVENT_VCONN_READ_READY) { |
| 344 | my_state->output_bytes = stats_add_resp_header(my_state); |
| 345 | TSVConnShutdown(my_state->net_vc, 1, 0); |
| 346 | my_state->write_vio = TSVConnWrite(my_state->net_vc, contp, my_state->resp_reader, INT64_MAX); |
| 347 | } else if (event == TS_EVENT_ERROR) { |
| 348 | TSError("[%s] stats_process_read: Received TS_EVENT_ERROR", PLUGIN_NAME); |
| 349 | } else if (event == TS_EVENT_VCONN_EOS) { |
| 350 | /* client may end the connection, simply return */ |
| 351 | return; |
| 352 | } else if (event == TS_EVENT_NET_ACCEPT_FAILED) { |
| 353 | TSError("[%s] stats_process_read: Received TS_EVENT_NET_ACCEPT_FAILED", PLUGIN_NAME); |
| 354 | } else { |
| 355 | printf("Unexpected Event %d\n", event); |
| 356 | TSReleaseAssert(!"Unexpected Event"); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | #define APPEND(a) my_state->output_bytes += stats_add_data_to_resp_buffer(a, my_state) |
| 361 |
no test coverage detected