Skip to content

Commit

Permalink
buffer: sync from upstream
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Feb 7, 2020
1 parent e84815e commit 319bfc1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/buffer
Submodule buffer updated 2 files
+47 −16 buffer.c
+137 −49 buffer.h
11 changes: 4 additions & 7 deletions src/uwsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ static void uwsc_io_read_cb(struct ev_loop *loop, struct ev_io *w, int revents)

#if UWSC_SSL_SUPPORT
if (cl->ssl)
ret = buffer_put_fd(rb, w->fd, -1, &eof, uwsc_ssl_read, cl->ssl);
ret = buffer_put_fd_ex(rb, w->fd, -1, &eof, uwsc_ssl_read, cl->ssl);
else
#endif
ret = buffer_put_fd(rb, w->fd, -1, &eof, NULL, NULL);
ret = buffer_put_fd(rb, w->fd, -1, &eof);

if (ret < 0) {
uwsc_error(cl, UWSC_ERROR_IO, "read error");
Expand Down Expand Up @@ -387,10 +387,10 @@ static void uwsc_io_write_cb(struct ev_loop *loop, struct ev_io *w, int revents)

#if UWSC_SSL_SUPPORT
if (cl->ssl)
ret = buffer_pull_to_fd(&cl->wb, w->fd, buffer_length(&cl->wb), uwsc_ssl_write, cl->ssl);
ret = buffer_pull_to_fd_ex(&cl->wb, w->fd, buffer_length(&cl->wb), uwsc_ssl_write, cl->ssl);
else
#endif
ret = buffer_pull_to_fd(&cl->wb, w->fd, buffer_length(&cl->wb), NULL, NULL);
ret = buffer_pull_to_fd(&cl->wb, w->fd, buffer_length(&cl->wb));

if (ret < 0) {
uwsc_error(cl, UWSC_ERROR_IO, "write error");
Expand Down Expand Up @@ -634,9 +634,6 @@ int uwsc_init(struct uwsc_client *cl, struct ev_loop *loop, const char *url,
ev_timer_init(&cl->timer, uwsc_timer_cb, 0.0, 1.0);
ev_timer_start(cl->loop, &cl->timer);

buffer_set_persistent_size(&cl->rb, UWSC_BUFFER_PERSISTENT_SIZE);
buffer_set_persistent_size(&cl->wb, UWSC_BUFFER_PERSISTENT_SIZE);

uwsc_handshake(cl, host, port, path, extra_header);

return 0;
Expand Down
1 change: 0 additions & 1 deletion src/uwsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#define HTTP_HEAD_LIMIT 4096
#define UWSC_MAX_CONNECT_TIME 5 /* second */
#define UWSC_BUFFER_PERSISTENT_SIZE 4096

/* WebSocket close status codes defined in RFC 6455, section 11.7 */
enum {
Expand Down

0 comments on commit 319bfc1

Please sign in to comment.