@@ -114,7 +114,9 @@ def resend(self, seq_id):
114114 _mac = self .expected_responses [seq_id ][0 ].mac .decode (UTF8_DECODE )
115115 _request = self .expected_responses [seq_id ][0 ].__class__ .__name__
116116
117- if self .expected_responses [seq_id ][2 ] <= MESSAGE_RETRY :
117+ if self .expected_responses [seq_id ][2 ] == - 1 :
118+ _LOGGER .debug ("Drop single %s to %s " , _request , _mac )
119+ elif self .expected_responses [seq_id ][2 ] <= MESSAGE_RETRY :
118120 if (
119121 isinstance (self .expected_responses [seq_id ][0 ], NodeInfoRequest )
120122 and not self .discovery_finished
@@ -142,35 +144,25 @@ def resend(self, seq_id):
142144 self .expected_responses [seq_id ][2 ] + 1 ,
143145 )
144146 else :
145- if self .expected_responses [seq_id ][2 ] + 1 == MESSAGE_RETRY :
146- _LOGGER .warning (
147- "Drop %s to %s because max retries %s reached" ,
148- _request ,
147+ _LOGGER .warning (
148+ "Drop %s to %s because max retries %s reached" ,
149+ _request ,
150+ _mac ,
151+ str (MESSAGE_RETRY + 1 ),
152+ )
153+ # Report node as unavailable for missing NodePingRequest
154+ if isinstance (self .expected_responses [seq_id ][0 ], NodePingRequest ):
155+ self .node_state (_mac , False )
156+ else :
157+ _LOGGER .debug (
158+ "Do a single ping request to %s to validate if node is reachable" ,
149159 _mac ,
150- str (MESSAGE_RETRY + 1 ),
151160 )
152- # Report node as unavailable for missing NodePingRequest
153- if isinstance (self .expected_responses [seq_id ][0 ], NodePingRequest ):
154- self .node_state (_mac , False )
155- else :
156- _LOGGER .debug (
157- "Do a ping request to %s to validate if node is reachable" ,
158- _mac ,
159- )
160- self .send (NodePingRequest (_mac ))
161- else :
162- if isinstance (self .expected_responses [seq_id ][0 ], NodePingRequest ):
163- _LOGGER .info (
164- "Drop single %s to %s " ,
165- _request ,
166- _mac ,
167- )
168- else :
169- _LOGGER .warning (
170- "Drop single %s to %s " ,
171- _request ,
172- _mac ,
173- )
161+ self .send (
162+ NodePingRequest (self .expected_responses [seq_id ][0 ].mac ),
163+ None ,
164+ MESSAGE_RETRY + 1 ,
165+ )
174166 del self .expected_responses [seq_id ]
175167
176168 def _send_message_loop (self ):
0 commit comments