mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
Unify connection status logging
This commit is contained in:
parent
dc70703f4e
commit
ba287cc0fc
@ -85,7 +85,7 @@ void NaiveClient::OnConnectComplete(int connection_id, int result) {
|
||||
void NaiveClient::HandleConnectResult(NaiveClientConnection* connection,
|
||||
int result) {
|
||||
if (result != OK) {
|
||||
Close(connection->id());
|
||||
Close(connection->id(), result);
|
||||
return;
|
||||
}
|
||||
DoRun(connection);
|
||||
@ -109,16 +109,17 @@ void NaiveClient::OnRunComplete(int connection_id, int result) {
|
||||
|
||||
void NaiveClient::HandleRunResult(NaiveClientConnection* connection,
|
||||
int result) {
|
||||
LOG(INFO) << "Connection " << connection->id()
|
||||
<< " ended: " << ErrorToString(result);
|
||||
Close(connection->id());
|
||||
Close(connection->id(), result);
|
||||
}
|
||||
|
||||
void NaiveClient::Close(int connection_id) {
|
||||
void NaiveClient::Close(int connection_id, int reason) {
|
||||
auto it = connection_by_id_.find(connection_id);
|
||||
if (it == connection_by_id_.end())
|
||||
return;
|
||||
|
||||
LOG(INFO) << "Connection " << connection_id
|
||||
<< " closed: " << ErrorToShortString(reason);
|
||||
|
||||
// The call stack might have callbacks which still have the pointer of
|
||||
// connection. Instead of referencing connection with ID all the time,
|
||||
// destroys the connection in next run loop to make sure any pending
|
||||
|
@ -38,7 +38,7 @@ class NaiveClient {
|
||||
void OnRunComplete(int connection_id, int result);
|
||||
void HandleRunResult(NaiveClientConnection* connection, int result);
|
||||
|
||||
void Close(int connection_id);
|
||||
void Close(int connection_id, int reason);
|
||||
|
||||
NaiveClientConnection* FindConnection(int connection_id);
|
||||
bool HasClosedConnection(NaiveClientConnection* connection);
|
||||
|
Loading…
Reference in New Issue
Block a user