-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index b4b6aa3..0105e09 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -338,52 +338,59 @@ void Wellenreiter::startClicked() | |||
338 | } | 338 | } |
339 | } | 339 | } |
340 | else | 340 | else |
341 | { | 341 | { |
342 | pcap->open( QFile( interface ) ); | 342 | pcap->open( QFile( interface ) ); |
343 | } | 343 | } |
344 | 344 | ||
345 | if ( !pcap->isOpen() ) | 345 | if ( !pcap->isOpen() ) |
346 | { | 346 | { |
347 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | 347 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); |
348 | return; | 348 | return; |
349 | } | 349 | } |
350 | 350 | ||
351 | // set capturer to non-blocking mode | 351 | // set capturer to non-blocking mode |
352 | pcap->setBlocking( false ); | 352 | pcap->setBlocking( false ); |
353 | 353 | ||
354 | // start channel hopper | 354 | // start channel hopper |
355 | if ( cardtype != DEVTYPE_FILE ) | 355 | if ( cardtype != DEVTYPE_FILE ) |
356 | iface->setChannelHopping( 1000 ); //use interval from config window | 356 | iface->setChannelHopping( 1000 ); //use interval from config window |
357 | 357 | ||
358 | if ( cardtype != DEVTYPE_FILE ) | 358 | if ( cardtype != DEVTYPE_FILE ) |
359 | { | 359 | { |
360 | // connect socket notifier and start channel hopper | 360 | // connect socket notifier and start channel hopper |
361 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 361 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
362 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 362 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
363 | } | 363 | } |
364 | else | 364 | else |
365 | { | 365 | { |
366 | // start timer for reading packets | 366 | // start timer for reading packets |
367 | startTimer( 100 ); | 367 | startTimer( 100 ); |
368 | } | 368 | } |
369 | 369 | ||
370 | logwindow->log( "(i) Started Scanning." ); | 370 | logwindow->log( "(i) Started Scanning." ); |
371 | sniffing = true; | 371 | sniffing = true; |
372 | emit( startedSniffing() ); | 372 | emit( startedSniffing() ); |
373 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 373 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
374 | else | 374 | else |
375 | { | 375 | { |
376 | assert( parent() ); | 376 | assert( parent() ); |
377 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." ); | 377 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." ); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | void Wellenreiter::timerEvent( QTimerEvent* ) | 382 | void Wellenreiter::timerEvent( QTimerEvent* ) |
383 | { | 383 | { |
384 | qDebug( "Wellenreiter::timerEvent()" ); | 384 | qDebug( "Wellenreiter::timerEvent()" ); |
385 | OPacket* p = pcap->next(); | 385 | OPacket* p = pcap->next(); |
386 | receivePacket( p ); | 386 | if ( !p ) // no more packets available |
387 | delete p; | 387 | { |
388 | stopClicked(); | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | receivePacket( p ); | ||
393 | delete p; | ||
394 | } | ||
388 | } | 395 | } |
389 | 396 | ||