Skip to content

Commit

Permalink
Land #260, Add the #remove_share method to the server
Browse files Browse the repository at this point in the history
Merge branch 'land-260' into upstream-master
  • Loading branch information
bwatters-r7 committed Jan 26, 2024
2 parents 196cf61 + 91ba4d4 commit 4883633
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 4883633

Please sign in to comment.