forked from MusicPlayerDaemon/MPD
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pull] master from MusicPlayerDaemon:master #24
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This logs the client address (or the process id and uid for local connections) in each log line instead of the number.
From https://github.com/CM4all/libcommon - the new class is mostly identical, and I want to maintain only one of them.
This might give tiny kernel-side optimizations.
This fixes a regression triggered by commit e309941 - IORING_SETUP_SINGLE_ISSUER broke because io_uring_setup() was called fromm the main thread, yet io_uring_submit() in the I/O thread. This is because the I/O thread was not yet started when InitUringInputPlugin() was called, and BlockingCall() was invoked synchronously in the main thread. This has always been wrong, but was never noticed.
This implements wraparound, so AsyncInputStream and ThreadInputStream can now return all of the buffer contents in one Read() call.
Reviewer's Guide by SourceryThis pull request refactors the way data is read from the input stream buffers, introduces client names, and adds support for peer credentials. Sequence diagram for client connection handlingsequenceDiagram
participant C as Client
participant S as ServerSocket
participant L as ClientListener
C->>S: Connect
S->>L: OnAccept(fd, address)
L->>L: GetPeerCredentials()
L->>L: MakeClientName(address, cred)
L->>C: Create new client
Note over C: Initialize with name<br/>instead of number
Class diagram for AsyncInputStream and ThreadInputStream changesclassDiagram
class AsyncInputStream {
-CircularBuffer buffer
-offset_type offset
+ReadFromBuffer(dest: std::span<std::byte>) std::size_t
+Read(lock: std::unique_lock<Mutex>, dest: std::span<std::byte>) size_t
}
class ThreadInputStream {
-CircularBuffer buffer
-offset_type offset
+ReadFromBuffer(dest: std::span<std::byte>) std::size_t
+Read(lock: std::unique_lock<Mutex>, dest: std::span<std::byte>) size_t
}
note for AsyncInputStream "Added ReadFromBuffer method
to handle buffer reading logic"
note for ThreadInputStream "Added ReadFromBuffer method
to handle buffer reading logic"
Class diagram for Client and SocketPeerCredentials changesclassDiagram
class Client {
-string name
-unsigned permission
-int uid
+Client(loop: EventLoop, partition: Partition, fd: UniqueSocketDescriptor, uid: int, permission: unsigned, name: string)
}
class SocketPeerCredentials {
+IsDefined() bool
+GetPid() int
+GetUid() int
+GetGid() int
+static Undefined() SocketPeerCredentials
}
note for Client "Replaced num with name field
for better client identification"
note for SocketPeerCredentials "New class for handling
peer credentials across
different platforms"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )
Summary by Sourcery
Refactor the input stream handling to use a new
MoveTo
method inCircularBuffer
for reading data. Update client identification to use peer credentials if available, falling back to the socket address. Start the IO threads earlier during initialization.