-
Notifications
You must be signed in to change notification settings - Fork 240
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
Conversation
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this 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
examples/BroadCastClient.cpp
Outdated
@@ -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())) |
There was a problem hiding this comment.
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]
^
include/brynet/net/TcpConnection.hpp
Outdated
@@ -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) |
There was a problem hiding this comment.
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]
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) |
There was a problem hiding this comment.
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]
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) |
There was a problem hiding this comment.
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]
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; |
There was a problem hiding this comment.
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]
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; |
There was a problem hiding this comment.
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]
mSocketOption.enterFailedCallback = callback; | |
mSocketOption.enterFailedCallback = std::move(callback); |
There was a problem hiding this 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())) |
There was a problem hiding this comment.
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]
^
No description provided.