| 652 | #endif |
| 653 | |
| 654 | void |
| 655 | hstcpsvr_worker::execute_lines(hstcpsvr_conn& conn) |
| 656 | { |
| 657 | DBG_MULTI(int cnt = 0); |
| 658 | dbconnstate& cstate = conn.cstate; |
| 659 | char *buf_end = cstate.readbuf.end(); |
| 660 | char *line_begin = cstate.readbuf.begin(); |
| 661 | char *find_pos = line_begin + cstate.find_nl_pos; |
| 662 | while (true) { |
| 663 | char *const nl = memchr_char(find_pos, '\n', buf_end - find_pos); |
| 664 | if (nl == 0) { |
| 665 | break; |
| 666 | } |
| 667 | char *const lf = (line_begin != nl && nl[-1] == '\r') ? nl - 1 : nl; |
| 668 | DBG_MULTI(cnt++); |
| 669 | execute_line(line_begin, lf, conn); |
| 670 | find_pos = line_begin = nl + 1; |
| 671 | } |
| 672 | cstate.readbuf.erase_front(line_begin - cstate.readbuf.begin()); |
| 673 | cstate.find_nl_pos = cstate.readbuf.size(); |
| 674 | DBG_MULTI(fprintf(stderr, "cnt=%d\n", cnt)); |
| 675 | } |
| 676 | |
| 677 | void |
| 678 | hstcpsvr_worker::execute_line(char *start, char *finish, hstcpsvr_conn& conn) |
nothing calls this directly
no test coverage detected