MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / execute_lines

Method execute_lines

handlersocket/hstcpsvr_worker.cpp:654–675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652#endif
653
654void
655hstcpsvr_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
677void
678hstcpsvr_worker::execute_line(char *start, char *finish, hstcpsvr_conn& conn)

Callers

nothing calls this directly

Calls 5

memchr_charFunction · 0.85
erase_frontMethod · 0.80
endMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected