Skip to content

Commit

Permalink
initialize @broekrs in server instead of in connection_factory
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Dec 13, 2024
1 parent 81ee5fd commit 2bbbcd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lavinmq/mqtt/connection_factory.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module LavinMQ
class ConnectionFactory < LavinMQ::ConnectionFactory
def initialize(@users : UserStore,
@vhosts : VHostStore,
@brokers : Brokers,
replicator : Clustering::Replicator)
@brokers = Brokers.new(@vhosts, replicator)
end

def start(socket : ::IO, connection_info : ConnectionInfo)
Expand Down
3 changes: 2 additions & 1 deletion src/lavinmq/server.cr
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ module LavinMQ
Schema.migrate(@data_dir, @replicator)
@users = UserStore.new(@data_dir, @replicator)
@vhosts = VHostStore.new(@data_dir, @users, @replicator)
@brokers = MQTT::Brokers.new(@vhosts, @replicator)
@parameters = ParameterStore(Parameter).new(@data_dir, "parameters.json", @replicator)
@connection_factories[Protocol::AMQP] = AMQP::ConnectionFactory.new(@users, @vhosts)
@connection_factories[Protocol::MQTT] = MQTT::ConnectionFactory.new(@users, @vhosts, @replicator)
@connection_factories[Protocol::MQTT] = MQTT::ConnectionFactory.new(@users, @vhosts, @brokers, @replicator)
apply_parameter
spawn stats_loop, name: "Server#stats_loop"
end
Expand Down

0 comments on commit 2bbbcd9

Please sign in to comment.