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