Skip to content

Conversation

drewdzzz
Copy link
Collaborator

@drewdzzz drewdzzz commented Mar 28, 2025

See commits for details.

Closes #99
Closes #108

Trailing whitespaces are forbidden by any codestyle, so the commit
removes them. Also, they can become annoying because some IDEs can
automatically remove them turning diff of a patch into a mess.
The function simply returns passed arguments, just like echo. Let's
call it with more convenient name that doesn't have anything in common
with benchmarks to use it in tests later.

Part of tarantool#108
@drewdzzz drewdzzz marked this pull request as ready for review March 28, 2025 14:41
All connection methods do not wrap keys and tuples into arrays - it's
responsibility of user to follow IPROTO format. The only exception is
method `call` (by mistake, I believe) - it wraps arguments into array
and it doesn't allow to pass raw MsgPack to this method since
`mpp::as_raw` tag does not work with any other tags. The commit makes
method `call` work like other methods - it won't wrap `args` by itself
anymore.

Closes tarantool#108
After decoding response data we check if the decoder advanced the
iterator to the end of the raw data. However, that's not true when
someone tries to decode data with non-matching format. The commit fixes
the assertion - we should check iterator only if data was successfully
decoded.

Closes tarantool#99
@drewdzzz
Copy link
Collaborator Author

Ignoring clang-format suggestions as they don't conform similar places in the file:

git clang-format upstream/master --diff
diff --git a/src/Client/RequestEncoder.hpp b/src/Client/RequestEncoder.hpp
index 2752d3b..3fd8800 100644
--- a/src/Client/RequestEncoder.hpp
+++ b/src/Client/RequestEncoder.hpp
@@ -316,9 +316,9 @@ RequestEncoder<BUFFER>::encodeCall(const std::string &func, const T &args)
 	m_Buf.write('\xce');
 	m_Buf.write(uint32_t{0});
 	encodeHeader(Iproto::CALL);
-	mpp::encode(m_Buf, mpp::as_map(std::forward_as_tuple(
-		MPP_AS_CONST(Iproto::FUNCTION_NAME), func,
-		MPP_AS_CONST(Iproto::TUPLE), args)));
+	mpp::encode(m_Buf,
+		    mpp::as_map(std::forward_as_tuple(MPP_AS_CONST(Iproto::FUNCTION_NAME), func,
+						      MPP_AS_CONST(Iproto::TUPLE), args)));
 	uint32_t request_size = (m_Buf.end() - request_start) - PREHEADER_SIZE;
 	++request_start;
 	request_start.set(__builtin_bswap32(request_size));
diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp
index 0fdde8c..2bedbb5 100644
--- a/test/ClientTest.cpp
+++ b/test/ClientTest.cpp
@@ -588,7 +588,7 @@ single_conn_call(Connector<BUFFER, NetProvider> &client)
 	const static char *return_multi   = "remote_multi";
 	const static char *return_nil     = "remote_nil";
 	const static char *return_map     = "remote_map";
-	const static char *echo		  = "remote_echo";
+	const static char *echo = "remote_echo";
 
 	Connection<Buf_t, NetProvider> conn(client);
 	int rc = test_connect(client, conn, localhost, port);

GitHub Actions does not support `macos-12` anymore - let's replace
it with the newer `macos-15` version.

What's about sanitizers - let's run them on `macos-14`, neither the
newest nor the oldest MacOS version.
@drewdzzz
Copy link
Collaborator Author

Fixed CI (removed outdated macOS-12 runner) - PTAL.

@drewdzzz drewdzzz merged commit d871bad into tarantool:master Mar 31, 2025
42 of 43 checks passed
@drewdzzz drewdzzz deleted the call_with_raw branch March 31, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call doesn't work with app::as_raw tag Assertion fails on decoding failure

3 participants