mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
Fix coding style of callback null tests
This commit is contained in:
parent
a3099ab7a1
commit
2fe35ccbe9
@ -56,7 +56,7 @@ NaiveClientConnection::~NaiveClientConnection() {
|
|||||||
int NaiveClientConnection::Connect(const CompletionCallback& callback) {
|
int NaiveClientConnection::Connect(const CompletionCallback& callback) {
|
||||||
DCHECK(client_socket_);
|
DCHECK(client_socket_);
|
||||||
DCHECK_EQ(next_state_, STATE_NONE);
|
DCHECK_EQ(next_state_, STATE_NONE);
|
||||||
DCHECK(connect_callback_.is_null());
|
DCHECK(!connect_callback_);
|
||||||
|
|
||||||
if (full_duplex_)
|
if (full_duplex_)
|
||||||
return OK;
|
return OK;
|
||||||
@ -84,7 +84,7 @@ void NaiveClientConnection::Disconnect() {
|
|||||||
|
|
||||||
void NaiveClientConnection::DoCallback(int result) {
|
void NaiveClientConnection::DoCallback(int result) {
|
||||||
DCHECK_NE(result, ERR_IO_PENDING);
|
DCHECK_NE(result, ERR_IO_PENDING);
|
||||||
DCHECK(!connect_callback_.is_null());
|
DCHECK(connect_callback_);
|
||||||
|
|
||||||
// Since Run() may result in Read being called,
|
// Since Run() may result in Read being called,
|
||||||
// clear connect_callback_ up front.
|
// clear connect_callback_ up front.
|
||||||
@ -181,7 +181,7 @@ int NaiveClientConnection::Run(const CompletionCallback& callback) {
|
|||||||
DCHECK(client_socket_);
|
DCHECK(client_socket_);
|
||||||
DCHECK(server_socket_handle_->socket());
|
DCHECK(server_socket_handle_->socket());
|
||||||
DCHECK_EQ(next_state_, STATE_NONE);
|
DCHECK_EQ(next_state_, STATE_NONE);
|
||||||
DCHECK(connect_callback_.is_null());
|
DCHECK(!connect_callback_);
|
||||||
|
|
||||||
run_callback_ = callback;
|
run_callback_ = callback;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Socks5ServerSocket::~Socks5ServerSocket() {
|
|||||||
int Socks5ServerSocket::Connect(const CompletionCallback& callback) {
|
int Socks5ServerSocket::Connect(const CompletionCallback& callback) {
|
||||||
DCHECK(transport_);
|
DCHECK(transport_);
|
||||||
DCHECK_EQ(STATE_NONE, next_state_);
|
DCHECK_EQ(STATE_NONE, next_state_);
|
||||||
DCHECK(user_callback_.is_null());
|
DCHECK(!user_callback_);
|
||||||
|
|
||||||
// If already connected, then just return OK.
|
// If already connected, then just return OK.
|
||||||
if (completed_handshake_)
|
if (completed_handshake_)
|
||||||
@ -173,8 +173,8 @@ int Socks5ServerSocket::Read(IOBuffer* buf,
|
|||||||
const CompletionCallback& callback) {
|
const CompletionCallback& callback) {
|
||||||
DCHECK(completed_handshake_);
|
DCHECK(completed_handshake_);
|
||||||
DCHECK_EQ(STATE_NONE, next_state_);
|
DCHECK_EQ(STATE_NONE, next_state_);
|
||||||
DCHECK(user_callback_.is_null());
|
DCHECK(!user_callback_);
|
||||||
DCHECK(!callback.is_null());
|
DCHECK(callback);
|
||||||
|
|
||||||
int rv = transport_->Read(buf, buf_len,
|
int rv = transport_->Read(buf, buf_len,
|
||||||
base::Bind(&Socks5ServerSocket::OnReadWriteComplete,
|
base::Bind(&Socks5ServerSocket::OnReadWriteComplete,
|
||||||
@ -191,8 +191,8 @@ int Socks5ServerSocket::Write(IOBuffer* buf,
|
|||||||
const CompletionCallback& callback) {
|
const CompletionCallback& callback) {
|
||||||
DCHECK(completed_handshake_);
|
DCHECK(completed_handshake_);
|
||||||
DCHECK_EQ(STATE_NONE, next_state_);
|
DCHECK_EQ(STATE_NONE, next_state_);
|
||||||
DCHECK(user_callback_.is_null());
|
DCHECK(!user_callback_);
|
||||||
DCHECK(!callback.is_null());
|
DCHECK(callback);
|
||||||
|
|
||||||
int rv =
|
int rv =
|
||||||
transport_->Write(buf, buf_len,
|
transport_->Write(buf, buf_len,
|
||||||
@ -213,7 +213,7 @@ int Socks5ServerSocket::SetSendBufferSize(int32_t size) {
|
|||||||
|
|
||||||
void Socks5ServerSocket::DoCallback(int result) {
|
void Socks5ServerSocket::DoCallback(int result) {
|
||||||
DCHECK_NE(ERR_IO_PENDING, result);
|
DCHECK_NE(ERR_IO_PENDING, result);
|
||||||
DCHECK(!user_callback_.is_null());
|
DCHECK(user_callback_);
|
||||||
|
|
||||||
// Since Run() may result in Read being called,
|
// Since Run() may result in Read being called,
|
||||||
// clear user_callback_ up front.
|
// clear user_callback_ up front.
|
||||||
@ -232,7 +232,7 @@ void Socks5ServerSocket::OnIOComplete(int result) {
|
|||||||
void Socks5ServerSocket::OnReadWriteComplete(const CompletionCallback& callback,
|
void Socks5ServerSocket::OnReadWriteComplete(const CompletionCallback& callback,
|
||||||
int result) {
|
int result) {
|
||||||
DCHECK_NE(ERR_IO_PENDING, result);
|
DCHECK_NE(ERR_IO_PENDING, result);
|
||||||
DCHECK(!callback.is_null());
|
DCHECK(callback);
|
||||||
|
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
was_ever_used_ = true;
|
was_ever_used_ = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user