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

add log in throw exception #129

Merged
merged 5 commits into from
Aug 20, 2022
Merged

add log in throw exception #129

merged 5 commits into from
Aug 20, 2022

Conversation

IronsDu
Copy link
Owner

@IronsDu IronsDu commented Aug 19, 2022

No description provided.

@github-actions
Copy link

clang-tidy review says "All clean, LGTM! 👍"

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -80,7 +80,7 @@ int main(int argc, char** argv)
reader.readUINT16();
int64_t addr = reader.readINT64();

if (addr == (int64_t)(dataSocket.get()))
if (addr == (int64_t) (dataSocket.get()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

                                  ^

@@ -54,7 +54,8 @@ class TcpConnection : public Channel,
size_t maxRecvBufferSize,
EnterCallback&& enterCallback,
const EventLoop::Ptr& eventLoop,
const SSLHelper::Ptr& sslHelper = nullptr)
const SSLHelper::Ptr& sslHelper = nullptr,
std::function<void()> enterFailedCallback = nullptr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the parameter 'enterFailedCallback' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

Suggested change
std::function<void()> enterFailedCallback = nullptr)
,const &

@@ -16,11 +16,11 @@

namespace brynet { namespace net { namespace detail {

static bool HelperAddTcpConnection(EventLoop::Ptr eventLoop, TcpSocket::Ptr socket, ConnectionOption option)
static void HelperAddTcpConnection(EventLoop::Ptr eventLoop, TcpSocket::Ptr socket, ConnectionOption option)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the parameter 'eventLoop' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

Suggested change
static void HelperAddTcpConnection(EventLoop::Ptr eventLoop, TcpSocket::Ptr socket, ConnectionOption option)
const &

@@ -136,7 +135,7 @@
mIOLoopDatas.clear();
}

bool addTcpConnection(TcpSocket::Ptr socket, ConnectionOption option)
void addTcpConnection(TcpSocket::Ptr socket, ConnectionOption option)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the parameter 'option' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

Suggested change
void addTcpConnection(TcpSocket::Ptr socket, ConnectionOption option)
const &

@@ -150,6 +150,12 @@ class BaseConnectionBuilder
return static_cast<Derived&>(*this);
}

Derived& WithEnterFailedCallback(std::function<void()> callback)
{
mOption.enterFailedCallback = callback;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'callback' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]

Suggested change
mOption.enterFailedCallback = callback;
mOption.enterFailedCallback = std::move(callback);

@@ -65,6 +65,12 @@ class BaseListenerBuilder
return static_cast<Derived&>(*this);
}

Derived& WithEnterFailedCallback(std::function<void()> callback)
{
mSocketOption.enterFailedCallback = callback;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'callback' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]

Suggested change
mSocketOption.enterFailedCallback = callback;
mSocketOption.enterFailedCallback = std::move(callback);

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -80,7 +80,7 @@ int main(int argc, char** argv)
reader.readUINT16();
int64_t addr = reader.readINT64();

if (addr == (int64_t)(dataSocket.get()))
if (addr == reinterpret_cast<int64_t>(dataSocket.get()))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]

                                  ^

@IronsDu IronsDu merged commit 2e7d54d into master Aug 20, 2022
@IronsDu IronsDu deleted the feature/add-log-iniothread branch August 20, 2022 00:00
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.

1 participant