Skip to content

Commit 7bfe3f8

Browse files
author
Martin Robinson
committed
Explicitly destroy the HTTPClientSession after it's finished.
Even if KJS doesn't garbage collect open HTTPClient, at least their HTTPClientSession's will not hang about with open sockets.
1 parent 9d794e7 commit 7bfe3f8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/ti.Network/http/http_client_binding.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,10 @@ namespace ti
798798
this->FireEvent(Event::HTTP_TIMEOUT);
799799
}
800800

801+
// Destroy the session here, so that even if this HTTPClient isn't
802+
// garbage collected, the socket will close.
803+
this->session = 0;
804+
801805
this->Set("connected", Value::NewBool(false));
802806
this->ChangeState(4); // closed
803807
}

0 commit comments

Comments
 (0)