mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibCore+LibTLS: Don't keep a "ready to write" notifier on all Sockets
The "ready to write" notifier we set up in generic socket connection is really only meant to detect a successful connection. Once we have a TCP connection, for example, it will fire on every event loop iteration. This was causing IRC Client to max out the CPU by getting this no-op notifier callback over and over. Since this was only used by TLSv12, I changed that code to create its own notifier instead. It might be possible to improve TLS performance by only processing writes when actually needed, but I didn't look very closely at that for this patch. :^)
This commit is contained in:
parent
9eaf22090f
commit
4b202a3c79
Notes:
sideshowbarker
2024-07-19 06:29:10 +09:00
Author: https://github.com/awesomekling
Commit: 4b202a3c79
5 changed files with 27 additions and 20 deletions
|
@ -142,7 +142,8 @@ bool TLSv12::common_connect(const struct sockaddr* saddr, socklen_t length)
|
|||
if (on_tls_ready_to_read)
|
||||
on_tls_ready_to_read(*this);
|
||||
};
|
||||
Core::Socket::on_ready_to_write = [this] {
|
||||
m_write_notifier = Core::Notifier::construct(fd(), Core::Notifier::Event::Write);
|
||||
m_write_notifier->on_ready_to_write = [this] {
|
||||
if (!Core::Socket::is_open() || !Core::Socket::is_connected() || Core::Socket::eof()) {
|
||||
// an abrupt closure (the server is a jerk)
|
||||
dbg() << "Socket not open, assuming abrupt closure";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue