Optimizing performance by less memory allocation times
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
1 parent
7da483cb1e
commit
3cf95b2bc8
1 file changed
+2
-2
+2
-2
@@ -244,7 +244,7 @@ static void connection_read_cb(struct ev_loop *loop, ev_io *w, int revents)
|
||||
handshake_done:
|
||||
#endif
|
||||
|
||||
if (uh_buf_available(buf) < UH_BUFFER_SIZE) {
|
||||
if (unlikely(uh_buf_available(buf) < 1)) {
|
||||
int off = con->parser.mark - buf->base;
|
||||
uh_buf_grow(buf, UH_BUFFER_SIZE);
|
||||
con->parser.mark = buf->base + off;
|
||||
@@ -252,7 +252,7 @@ handshake_done:
|
||||
|
||||
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 (con->flags & UH_CON_CLOSE)
|
||||
uh_connection_destroy(con);
|
||||
|
||||
Reference in new issue
Block a user