summaryrefslogtreecommitdiff
path: root/Libraries/LibCore/Socket.cpp
AgeCommit message (Collapse)Author
2020-12-23LibCore: Stop logging that a Core::Socket has disconnected in receive()Andreas Kling
This is perfectly normal and nothing we need to inform about.
2020-12-16LibCore: Expose some Socket properties to make then inspectableConrad Pankoff
2020-08-30Everywhere: Port to String::copy_characters_to_buffer()Sergey Bugaev
2020-08-24LibCore: Prefer strlcpy over strncpy, fix overflowBen Wiederhake
A malicious caller can create a SocketAddress for a local unix socket with an over-long name that does not fit into struct sock_addr_un. - Socket::connet: This caused the 'sun_path' field to overflow, probably overwriting the return pointer of the call frame, and thus crashing the process (in the best case). - SocketAddress::to_sockaddr_un: This triggered a RELEASE_ASSERT, and thus crashing the process. Both have been fixed to return a nice error code instead of crashing.
2020-07-27LibCore: Change the signature of Socket::send() to use Span.asynts
2020-07-06LibCore: Don't fire Socket::on_ready_to_read if !can_read()Andreas Kling
This is a bit of a pickle and I'm unsure what's the best behavior here. Since notifiers fire asynchronously via the event loop, we may end up firing a notifier for a socket fd, but then reading/writing that socket fd before ending up in the notifier callback. In that situation, the socket is no longer in the same state as it was when the event loop generated the notifier event. This patch stops Socket from firing one hook in this situation but this probably needs a global rethink. With this change, Browser starts reliably in multi-process mode. :^)
2020-06-08LibCore: Make sure to disable notifiers when closing a socketSergey Bugaev
RefPtr<Notifier> doesn't work quite like it appears to, since the notifier is also a "child" of the socket, in Core::Object sense. Thus we have to both remove it from the parent (socket) and drop the additional RefPtr<Notifier> for it to actually go away. A proper fix for this would be to untangle parent-child relashionship from refcounting and inspectability. This fixes use-after-close of client file descriptors in IPC servers.
2020-05-18LibCore+LibTLS: Don't keep a "ready to write" notifier on all SocketsAndreas Kling
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. :^)
2020-05-02LibCore: Mark Socket::{common_,}connect() virtual and add a on_writeAnotherTest
2020-02-22LibCore: Log a more helpful message when Socket::connect() failsAndreas Kling
Fixes #1272.
2020-02-20AK: Use size_t for ByteBuffer sizesAndreas Kling
This matches what we already do for string types.
2020-02-14LibCore: Add a forward declaration headerAndreas Kling
This patch adds <LibCore/Forward.h> and uses it in various places to shrink the header dependency graph.
2020-02-06LibCore: Remove leading C from filenamesAndreas Kling