@@ -649,28 +649,30 @@ func (s *Server) InjectPacket(cl *Client, pk packets.Packet) error {
649
649
650
650
// processPublish processes a Publish packet.
651
651
func (s * Server ) processPublish (cl * Client , pk packets.Packet ) error {
652
- if ! IsValidFilter (pk .TopicName , true ) && ! cl . Net . Inline {
652
+ if ! cl . Net . Inline && ! IsValidFilter (pk .TopicName , true ) {
653
653
return nil
654
654
}
655
655
656
656
if atomic .LoadInt32 (& cl .State .Inflight .receiveQuota ) == 0 {
657
657
return s .DisconnectClient (cl , packets .ErrReceiveMaximum ) // ~[MQTT-3.3.4-7] ~[MQTT-3.3.4-8]
658
658
}
659
659
660
- if ! s .hooks .OnACLCheck (cl , pk .TopicName , true ) && ! cl . Net . Inline {
660
+ if ! cl . Net . Inline && ! s .hooks .OnACLCheck (cl , pk .TopicName , true ) {
661
661
return nil
662
662
}
663
663
664
664
pk .Origin = cl .ID
665
665
pk .Created = time .Now ().Unix ()
666
666
667
- if pki , ok := cl .State .Inflight .Get (pk .PacketID ); ok && ! cl .Net .Inline {
668
- if pki .FixedHeader .Type == packets .Pubrec { // [MQTT-4.3.3-10]
669
- ack := s .buildAck (pk .PacketID , packets .Pubrec , 0 , pk .Properties , packets .ErrPacketIdentifierInUse )
670
- return cl .WritePacket (ack )
671
- }
672
- if ok := cl .State .Inflight .Delete (pk .PacketID ); ok { // [MQTT-4.3.2-5]
673
- atomic .AddInt64 (& s .Info .Inflight , - 1 )
667
+ if ! cl .Net .Inline {
668
+ if pki , ok := cl .State .Inflight .Get (pk .PacketID ); ok {
669
+ if pki .FixedHeader .Type == packets .Pubrec { // [MQTT-4.3.3-10]
670
+ ack := s .buildAck (pk .PacketID , packets .Pubrec , 0 , pk .Properties , packets .ErrPacketIdentifierInUse )
671
+ return cl .WritePacket (ack )
672
+ }
673
+ if ok := cl .State .Inflight .Delete (pk .PacketID ); ok { // [MQTT-4.3.2-5]
674
+ atomic .AddInt64 (& s .Info .Inflight , - 1 )
675
+ }
674
676
}
675
677
}
676
678
0 commit comments