Skip to content
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

Add the #remove_share method to the server #260

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/ruby_smb/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,21 @@ def initialize(server_sock: nil, gss_provider: nil, logger: nil, thread_factory:
}
end

# @param [Share::Provider::Base] share_provider the share provider to register
def add_share(share_provider)
logger.debug("Adding #{share_provider.type} share: #{share_provider.name}")
@shares[share_provider.name] = share_provider
end

# @param [String, Share::Provider::Base] share_provider the share provider to deregister
def remove_share(share_provider)
share_provider = share_provider.name if share_provider.is_a?(RubySMB::Server::Share::Provider::Base)
logger.debug("Removing share: #{share_provider}")
@shares.delete(share_provider)

nil
end

# Run the server and accept any connections. For each connection, the block will be executed if specified. When the
# block returns false, the loop will exit and the server will no long accept new connections.
def run(&block)
Expand Down
Loading