diff options
-rw-r--r-- | net/socket_stream/socket_stream.cc | 2 | ||||
-rw-r--r-- | net/websockets/websocket_job.cc | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 159779a..8ea686a 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -418,7 +418,7 @@ void SocketStream::OnReadCompleted(int result) { } void SocketStream::OnWriteCompleted(int result) { - if (result >= 0 && write_buf_) { + if (result > 0 && write_buf_) { result = DidSendData(result); } DoLoop(result); diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index 72796b1..cbf7592 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -212,6 +212,7 @@ void WebSocketJob::OnConnected( void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { DCHECK_NE(INITIALIZED, state_); + DCHECK_GT(amount_sent, 0); if (state_ == CLOSED) return; if (state_ == CONNECTING) { @@ -220,8 +221,10 @@ void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { } if (delegate_) { DCHECK(state_ == OPEN || state_ == CLOSING); - DCHECK_GT(amount_sent, 0); - DCHECK(current_buffer_); + if (current_buffer_ == NULL) { + VLOG(1) << "OnSentData current_buffer=NULL amount_sent=" << amount_sent; + return; + } current_buffer_->DidConsume(amount_sent); if (current_buffer_->BytesRemaining() > 0) return; |