提交 f6c75246 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix #529

上级 6f2d110a
...@@ -493,13 +493,12 @@ inline void TcpConnection::OnUvWrite(int status, TcpConnection::onSendCallback* ...@@ -493,13 +493,12 @@ inline void TcpConnection::OnUvWrite(int status, TcpConnection::onSendCallback*
{ {
MS_TRACE(); MS_TRACE();
// NOTE: Do not delete cb here since it will be delete in onWrite() above.
if (status == 0) if (status == 0)
{ {
if (cb) if (cb)
{
(*cb)(true); (*cb)(true);
delete cb;
}
} }
else else
{ {
...@@ -509,10 +508,7 @@ inline void TcpConnection::OnUvWrite(int status, TcpConnection::onSendCallback* ...@@ -509,10 +508,7 @@ inline void TcpConnection::OnUvWrite(int status, TcpConnection::onSendCallback*
MS_WARN_DEV("write error, closing the connection: %s", uv_strerror(status)); MS_WARN_DEV("write error, closing the connection: %s", uv_strerror(status));
if (cb) if (cb)
{
(*cb)(false); (*cb)(false);
delete cb;
}
Close(); Close();
......
...@@ -288,13 +288,12 @@ inline void UdpSocket::OnUvSend(int status, UdpSocket::onSendCallback* cb) ...@@ -288,13 +288,12 @@ inline void UdpSocket::OnUvSend(int status, UdpSocket::onSendCallback* cb)
{ {
MS_TRACE(); MS_TRACE();
// NOTE: Do not delete cb here since it will be delete in onSend() above.
if (status == 0) if (status == 0)
{ {
if (cb) if (cb)
{
(*cb)(true); (*cb)(true);
delete cb;
}
} }
else else
{ {
...@@ -303,9 +302,6 @@ inline void UdpSocket::OnUvSend(int status, UdpSocket::onSendCallback* cb) ...@@ -303,9 +302,6 @@ inline void UdpSocket::OnUvSend(int status, UdpSocket::onSendCallback* cb)
#endif #endif
if (cb) if (cb)
{
(*cb)(false); (*cb)(false);
delete cb;
}
} }
} }
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论