| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
in the request parser the new endcap token was always the end of the
line, but it should be the start of the next token. For some use cases
the scanning stops early, or if we have too many tokens it would make
the final token look like the rest of the line.
|
|
|
|
|
|
| |
function accepts a flag, returns (bool, token|nil).
bool indicates if the flag exists, and if the flag has a token it is
returned instead of nil as the second value.
|
|
|
|
|
|
|
|
|
| |
Adds resp:code(), which returns code you can compare with
mcp.MCMC_CODE_*
Adds resp:line(), which returns the raw response line after the command.
This can be used in lua while the flag/token API is missing for the
response object.
|
|
|
|
|
|
|
|
|
| |
Add mcp.request function for quick checking if a flag exists in a
request string.
Also updates internal code for checking the length of a token to use the
endcap properly, and uses that for the r:token(n) requets as well, which
fixes a subtle bug of the token length being too long.
|
|
|
|
|
|
|
|
|
|
| |
- errors if a string value is missing the "\r\n" terminator
- properly uses a value from a response object
- allows passing in a request object for the value as well
- also adds r:vlen() for recovering the value length of a response
think this still needs r:flags() or similar?
|
|
|
|
|
|
|
|
|
| |
mcplib_request_token() allows us to parse each token in a request string. The
existing implementation delimits tokens using <whitespace>. This approach
works for every token but the last one which will be followed by \r\n.
This patch uses the token offsets present within the request parser to calculate
the token boundaries instead of looping until the next delimiter.
|
|
|
|
| |
via SSL_OP_NO_RENEGOTIATION option
|
|
|
|
|
|
| |
This fixes a warning from clang about undefined behavior:
error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
|
|
|
|
| |
add proxy_debug flag for protocol handler in verbose printing
|
|
|
|
|
|
|
| |
GCC 12 on ppc64el complains about "key" being undefined on testapp.c.
This commit silences the error.
Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
|
|
|
|
|
|
|
|
|
| |
obvious once tracked down: STAILQ_FOREACH is actively using io->io_next,
and the return call can free and potentially reuse the object if the
thread gets suspended.
There're _SAFE forms of the FOREACH but the reset flow shouldn't happen
often enough to be worth using more than this standard pattern.
|
|
|
|
|
|
| |
was checking the third lua arg, popping it, then likely never finding
the fourth arg. now checks fourth arg first and pops it, then works
backwards.
|
| |
|
|
|
|
|
|
|
|
| |
If a command was partially sent we were not decrementing the byte sum
cache. This would lead to listening on the wrong event and potentially
causing corruption.
It might be better to remove the cache to avoid mistakes like
this and for loop it each time.
|
|
|
|
|
|
|
|
|
| |
well I tested it a few times during the code split PR, but apparently
not with the final PR. This updates the API and also fixes some
compilation issues.
There will still be bugs until I reorganize the sqe/cqe lifecycle but it
can still be tested.
|
|
|
|
|
|
|
|
|
|
|
| |
experimental change. *io_uring mode is presently broken*
there are some potential protocol desync bugs due to mcmc handling its
own buffers and the newer event handler handling its own syscalls.
this change should have better separation of code for the buffer
tracking. if this change works I will add some optimizations to reduce
memmove's.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Ideally we should be able to see the requst logs only after:
"watch proxyreqs"
|
|
|
|
|
|
|
|
|
| |
delete the magic logging and require mcp.log_req* be used if you want
those types of entries to appear. keeps a separate data stream from
"proxyuser" just in case that's useful.
proxycmds wasn't able to get enough context to autogenerate useful log
lines, so I'd rather not have it in there at all.
|
|
|
|
|
|
| |
Lua level API for logging full context of a request/response. Provides
log_req() for simple logging and log_reqsample() for conditional
logging.
|
| |
|
|
|
|
|
|
|
|
| |
previously mcp.await() only worked if it was called before any other
dispatches.
also fixes a bug if the supplied pool table was key=value instead of an
array-type table.
|
|
|
|
|
|
|
|
|
| |
mcp.request can now take a response object and internally copy the
value. bit faster than doing it through C.
iterating from here should allow taking a reference to the resp object
and directly pointing to its value, but we need to make resp objects
immutable first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
avoids sending the response to the client, in most cases. works by
stripping the noreply status from the request before sending it along,
so the proxy itself knows when to move the request forward.
has sharp edges:
- only looking at the request object that's actually sent to the
backend, instead of the request object that created the coroutine.
- overriding tokens in lua to re-set the noreply mode would break the
protocol.
So this change helps us validate the feature but solidifying it requires
moving it to the "edges" of processing; before the coroutine and after
any command assembly (or within the command assembly).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this is ketama-based, with options for minor compat changes with major
libraries.
does _not_ support weights. The weights bits in the original ketama
broke the algorithm, as changing the number of points would shift
unrelated servers when the list changes.
this also changes backends to take a "name" specifically, instead of an
"ip address". Though note if supplying a hostname instead of an IP there
might be inline DNS lookups on reconnects.
|
|
|
|
|
|
| |
wasn't setting e->size of the log entry, so the data would corrupt.
think I need an assert on e->size not being set from the function?
|
|
|
|
|
|
| |
allows tests to run faster, let users make it sleep longer/less time.
Also cuts the sleep time down when actively compacting and coming from
high idle.
|
|
|
|
|
|
|
|
|
| |
now's a good time to at least shove functional subsections of code into
their own files. Some further work to clearly separate the API's will
help but looks not too terrible.
Big bonus is getting the backend handling code away from the frontend
handling code, which should make it easier to follow.
|
| |
|
|
|
|
| |
not sure if I want to add the config file path since that could end up being an info leak.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds MCP_AWAIT_* options as 4th argument. If waiting for a subset of
requests instead of all requests, the 4th argument can specify what type
of responses are considered valid.
Also now includes _all_ observed results in the result table, when a
specific number of "good" results are requested. The caller is supposed
to filter for its intent. This allows observation of error codes if all
requested results fail or it otherwise fails to meet its result
conditions (via AWAIT_*)
|
|
|
|
|
| |
global only setting, not able to be changed for existing backends on
config reload. a few fixes would improve but not can do later.
|
| |
|
|
|
|
|
|
|
| |
Fix is a little subtle: there's a race condition when a user stat is
added to the global context but the worker threads aren't updated yet.
So we check that the context in the user thread has enough stats slots
to iterate, and that the user thread has stats at all.
|
| |
|
|
|
|
|
|
|
| |
I wanted to do this via lua with some on-close hooks on the coroutine
but this might work for now. not 100% sure I caught all of the incr/decr
cases properly. Was trying to avoid hitting the counters too hard as
well.
|
| |
|
|
|
|
|
|
|
| |
adds watch commands for:
proxycmds - internal raw timing log (tbd?)
proxyevents - config updates, internal errors, etc
proxyuser - logs generated by mcp.log()
|
|
|
|
| |
added to "stats proxy" output. counters of commands seen at inbound.
|
|
|
|
| |
need better option for this.. seems to fix this one thing.
|
|
|
|
| |
valiate -> validate
|
|
|
|
|
|
| |
Extbuf needs to have 48 bytes because it is used
for protocol_binary_request_incr union. Unions member
message is alligned to 48 bytes.
|
|
|
|
|
| |
lsitener thread may not have actually accepted everything by the time we
start closing them, so it might not show rejected connections.
|
|
|
|
|
|
|
|
| |
Previous commit fixes the main hash addressing, this adds further
repairs to hash expansion and hash table walker.
HASHPOWER_MAX stays at 32, since the computed hashvalue is 32bit and
going beyond that would break things rather badly :)
|
|
|
|
|
|
| |
Remove use of confusing ub4 type in hashsize calculation, which actually needs to be greater than 4 byte.
Remove unused ub4 and ub1 typedefs.
|