Optimizing performance by less memory allocation times
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>main
parent
7da483cb1e
commit
3cf95b2bc8
|
@ -244,7 +244,7 @@ static void connection_read_cb(struct ev_loop *loop, ev_io *w, int revents)
|
||||||
handshake_done:
|
handshake_done:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (uh_buf_available(buf) < UH_BUFFER_SIZE) {
|
if (unlikely(uh_buf_available(buf) < 1)) {
|
||||||
int off = con->parser.mark - buf->base;
|
int off = con->parser.mark - buf->base;
|
||||||
uh_buf_grow(buf, UH_BUFFER_SIZE);
|
uh_buf_grow(buf, UH_BUFFER_SIZE);
|
||||||
con->parser.mark = buf->base + off;
|
con->parser.mark = buf->base + off;
|
||||||
|
@ -252,7 +252,7 @@ handshake_done:
|
||||||
|
|
||||||
base = buf->base + buf->len;
|
base = buf->base + buf->len;
|
||||||
|
|
||||||
len = uh_ssl_read(con, base, UH_BUFFER_SIZE);
|
len = uh_ssl_read(con, base, uh_buf_available(buf));
|
||||||
if (unlikely(len <= 0)) {
|
if (unlikely(len <= 0)) {
|
||||||
if (con->flags & UH_CON_CLOSE)
|
if (con->flags & UH_CON_CLOSE)
|
||||||
uh_connection_destroy(con);
|
uh_connection_destroy(con);
|
||||||
|
|
Loading…
Reference in New Issue