How Soulseek Works
This document should explain how Soulseek messages are recieved, proccessed and responded to in Museekd.
Downloading a Folder
Downloading a directory via Search issues as FolderContentsRequest? (36) message, which asks the remote client to examine the directory you requested, and send to you a FolderContentsResponse? (37) containing the files in that directory. You then read that message and queue the files.
Downloading a directory via Browse Shares parses the shares database and selects all the files in the directory (and possibly the subdirectories) a directly queue the files.
- Museekd Recieved a Transfer Request
- Parse it to know the username, direction, ticket, filename and -- if it's a download -- the filesize.
- If the username is mine, Abort transfer and send an Upload Reply about not being able to transfer to yourself.
- If the username is banned, send an Upload Reply about being 'banned or sharing list only'
- If the file is NOT in the buddy shares and you ENABLED buddy shares and the username is buddied then send an Upload Reply about the file 'not being shared'
- If the file IS in the buddy shares and buddy shares are ENABLED and the username is not buddied and the file is not in NORMAL shares then send an Upload Reply about the file 'not being shared'
- If the file is NOT in the NORMAL shares and NOT in the BUDDY shares send an Upload Reply about the file 'not being shared'
NO BAD MATCHES:
- If none of the above are true check if there is an open upload slot. If there is, try to start uploading, if there isn't queue the file.
- If the username is mine, Abort transfer and send an Download Reply about not being able to transfer to yourself.
- Look for a previously initated download transfer with this user and path
- If the download hasn't been initiated, yet and the user isn't a trusted user abort it. If the user is trusted, create a new download.
- If the download has been initiated, start downloading, otherwise send a 'Canceled' message.