Browse Source

Fix server buffer #1245

pull/1246/head
Max Lv 7 years ago
parent
commit
9716eede20
1 changed files with 4 additions and 2 deletions
  1. 6
      src/server.c

6
src/server.c

@ -549,15 +549,17 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
remote_t *remote = NULL;
buffer_t *buf = server->buf;
size_t len = server->buf->len;
if (server->stage == STAGE_STREAM) {
remote = server->remote;
buf = remote->buf;
len = 0;
ev_timer_again(EV_A_ & server->recv_ctx->watcher);
}
ssize_t r = recv(server->fd, buf->data, BUF_SIZE, 0);
ssize_t r = recv(server->fd, buf->data + len, BUF_SIZE - len, 0);
if (r == 0) {
// connection closed
@ -581,7 +583,7 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
}
tx += r;
buf->len = r;
buf->len += r;
int err = crypto->decrypt(buf, server->d_ctx, BUF_SIZE);

Loading…
Cancel
Save