Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.1.0 changes #6

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Funnels file descriptor in readable stream into event loop and thence executes a
- **nbytes** (int|null) - The number of bytes to read.
> Specifying `null` will condition the use of a 1KB buffer.
- **vcount** (int|null) - The number of read vectors to use.
> Specifying `null` will condition the use of 2 vectors.
> Specifying `null` will condition the use of `1` vector.
> Any value north of `8` will likely result in an inefficient read.
- **offset** (int|null) - The point at which to start the read operation.
> Specifying `null` will condition the use of an offset of `0`.
Expand Down Expand Up @@ -214,7 +214,7 @@ Funnels file descriptor in writable stream into event loop and thence executes a
> The file descriptor in the stream is internally given a non-blocking disposition.
- **contents** (string) - The contents to write to the file descriptor.
- **vcount** (int|null) - The number of write vectors to use.
> Specifying `null` will condition the use of 2 vectors.
> Specifying `null` will condition the use of `1` vector.
> Any value north of `8` will likely result in an inefficient write.
- **callback** (callable) - The unary function through which the number of written bytes is propagated.

Expand Down
6 changes: 3 additions & 3 deletions src/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void *php_mrloop_tcp_client_setup(int fd, char **buffer, int *bsize)

conn = emalloc(sizeof(php_mrloop_conn_t));
conn->fd = fd;
conn->buffer = emalloc(MRLOOP_G(tcp_buff_size));
conn->buffer = ecalloc(1, MRLOOP_G(tcp_buff_size));
*buffer = conn->buffer;
*bsize = MRLOOP_G(tcp_buff_size);

Expand Down Expand Up @@ -587,7 +587,7 @@ static void php_mrloop_add_read_stream(INTERNAL_FUNCTION_PARAMETERS)
foffset = (size_t)(offset_null == true ? DEFAULT_READV_OFFSET : offset);

iov = emalloc(sizeof(php_iovec_t));
iov->iov_base = emalloc(fnbytes);
iov->iov_base = ecalloc(1, fnbytes);
iov->iov_len = fnbytes;

cb = emalloc(sizeof(php_mrloop_cb_t));
Expand Down Expand Up @@ -634,7 +634,7 @@ static void php_mrloop_add_write_stream(INTERNAL_FUNCTION_PARAMETERS)

nbytes = ZSTR_LEN(contents);
iov = emalloc(sizeof(php_iovec_t));
iov->iov_base = emalloc(nbytes);
iov->iov_base = ecalloc(1, nbytes);
iov->iov_len = nbytes;

strcpy(iov->iov_base, ZSTR_VAL(contents));
Expand Down
2 changes: 1 addition & 1 deletion src/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define DEFAULT_STREAM_BUFF_LEN 1024
#define DEFAULT_CONN_BUFF_LEN 8132
#define DEFAULT_HTTP_HEADER_LIMIT 100
#define DEFAULT_VECTOR_COUNT 2
#define DEFAULT_VECTOR_COUNT 1
#define DEFAULT_READV_OFFSET 0
#define PHP_MRLOOP_TIMER 1
#define PHP_MRLOOP_PERIODIC_TIMER 2
Expand Down