mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
@@ -127,11 +127,13 @@ bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
|
||||
if (!m_connected) {
|
||||
m_connected = true;
|
||||
ensure_read_notifier();
|
||||
if (m_notifier) {
|
||||
m_notifier->remove_from_parent();
|
||||
m_notifier = nullptr;
|
||||
}
|
||||
if (on_connected)
|
||||
on_connected();
|
||||
}
|
||||
if (on_ready_to_write)
|
||||
on_ready_to_write();
|
||||
};
|
||||
int rc = ::connect(fd(), addr, addrlen);
|
||||
if (rc < 0) {
|
||||
|
||||
@@ -63,7 +63,6 @@ public:
|
||||
|
||||
Function<void()> on_connected;
|
||||
Function<void()> on_ready_to_read;
|
||||
Function<void()> on_ready_to_write;
|
||||
|
||||
protected:
|
||||
Socket(Type, Object* parent);
|
||||
|
||||
Reference in New Issue
Block a user