| 657 | } |
| 658 | |
| 659 | static int handle_io(struct fd_map *fm, int idx, int event_type) |
| 660 | { |
| 661 | stream_send_t *jsonrpcs; |
| 662 | struct stream_con *con; |
| 663 | |
| 664 | switch (fm->type) { |
| 665 | case F_EV_JSONRPC_CMD: |
| 666 | jsonrpcs = stream_receive(); |
| 667 | if (!jsonrpcs) { |
| 668 | LM_ERR("invalid receive jsonrpc command\n"); |
| 669 | return -1; |
| 670 | } |
| 671 | |
| 672 | handle_new_stream(jsonrpcs); |
| 673 | break; |
| 674 | case F_EV_JSONRPC_RPL: |
| 675 | con = (struct stream_con *)fm->data; |
| 676 | if (event_type == IO_WATCH_READ) |
| 677 | handle_reply_jsonrpc(con); |
| 678 | else |
| 679 | handle_write_jsonrpc(con); |
| 680 | break; |
| 681 | default: |
| 682 | LM_CRIT("unknown fd type %d in JSON-RPC handler\n", fm->type); |
| 683 | return 0; |
| 684 | } |
| 685 | return 0; |
| 686 | } |
| 687 | |
| 688 | static void stream_cleanup_old(void) |
| 689 | { |
nothing calls this directly
no test coverage detected