Skip to content

Commit

Permalink
ameba
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Jan 29, 2025
1 parent aa466e1 commit 229d9dd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion spec/mqtt/integrations/will_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ module MqttSpecs
subscribe(io, topic_filters: topic_filters)

pub = read_packet(io).should be_a(MQTT::Protocol::Publish)
pp pub
pub.payload.should eq("dead".to_slice)
pub.topic.should eq("will/t")
pub.retain?.should eq(true)
Expand Down
1 change: 1 addition & 0 deletions src/lavinmq/launcher.cr
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module LavinMQ
end
end

# ameba:disable Metrics/CyclomaticComplexity
private def start_listeners(amqp_server, http_server)
if @config.amqp_port > 0
spawn amqp_server.listen(@config.amqp_bind, @config.amqp_port, Server::Protocol::AMQP),
Expand Down
2 changes: 1 addition & 1 deletion src/lavinmq/mqtt/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ module LavinMQ

private def publish_will
if will = @will
packet = @broker.publish MQTT::Publish.new(
@broker.publish MQTT::Publish.new(
topic: will.topic,
payload: will.payload,
packet_id: nil,
Expand Down
2 changes: 0 additions & 2 deletions src/lavinmq/mqtt/session.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ module LavinMQ
end
consumer = consumers.first.as(MQTT::Consumer)
get_packet do |pub_packet|
pp pub_packet
consumer.deliver(pub_packet)
end
Fiber.yield if (i &+= 1) % 32768 == 0
Expand Down Expand Up @@ -144,7 +143,6 @@ module LavinMQ

def build_packet(env, packet_id) : MQTT::Publish
msg = env.message
pp msg
retained = msg.properties.try &.headers.try &.["mqtt.retain"]? == true
qos = msg.properties.delivery_mode || 0u8
qos = 1u8 if qos > 1
Expand Down

0 comments on commit 229d9dd

Please sign in to comment.