File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -264,11 +264,29 @@ def test_udp_channel
264264 end
265265
266266 it '[UDP] Receives data from the peer' do
267+ print_status ( "[UDP] Monitoring 'Receives data from the peer' test..." )
267268 client , server_client = udp_socket_pair
268269 data = Random . new . bytes ( rand ( 10 ..100 ) )
270+ print_status ( "[UDP] Sending data to #{ Rex ::Socket . to_authority ( client . localhost , client . localport ) } " )
269271 server_client . send ( data , 0 , client . localhost , client . localport )
270- received , _ = client . recvfrom ( data . length )
272+ received = ''
273+ remaining = 20 # seconds
274+ while remaining > 0
275+ chunk , elapsed_time = Rex ::Stopwatch . elapsed_time do
276+ chunk , _ = client . recvfrom ( data . length )
277+ chunk
278+ end
279+ received << chunk
280+ remaining -= elapsed_time
281+ end
271282 ret = received == data
283+ unless ret
284+ print_warning ( "[UDP] Receives data from the peer failed in #{ 20 } seconds" )
285+ print_warning ( "[UDP] expected: #{ data . unpack1 ( 'H*' ) } " )
286+ if received
287+ print_warning ( "[UDP] received: #{ received . unpack1 ( 'H*' ) } " )
288+ end
289+ end
272290 client . close
273291 server_client . close
274292 ret
You can’t perform that action at this time.
0 commit comments