-rw-r--r-- | libopie2/opienet/opcap.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 067d6b7..f8ebe6b 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -1254,68 +1254,66 @@ bool OPacketCapturer::open( const QString& name ) odebug << "OPacketCapturer::open(): libpcap [" << name << "] opened successfully." << oendl; _pch = handle; _open = true; _stats.clear(); // in case we have an application object, create a socket notifier if ( qApp ) //TODO: I don't like this here... { _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read ); connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) ); } return true; } bool OPacketCapturer::openDumpFile( const QString& filename ) { pcap_dumper_t* dump = pcap_dump_open( _pch, const_cast<char*>( (const char*) filename ) ); if ( !dump ) { owarn << "OPacketCapturer::open(): can't open dump with '" << filename << "': " << _errbuf << oendl; return false; } odebug << "OPacketCapturer::open(): dump [" << filename << "] opened successfully." << oendl; _pcd = dump; return true; } -bool OPacketCapturer::open( const QFile& file ) +bool OPacketCapturer::openCaptureFile( const QString& name ) { - QString name = file.name(); - if ( _open ) { close(); if ( name == _name ) // ignore opening an already openend device { return true; } else // close the last opened device { close(); } } _name = name; pcap_t* handle = pcap_open_offline( const_cast<char*>( (const char*) name ), &_errbuf[0] ); if ( handle ) { odebug << "OPacketCapturer::open(): libpcap opened successfully." << oendl; _pch = handle; _open = true; // in case we have an application object, create a socket notifier if ( qApp ) { _sn = new QSocketNotifier( fileno(), QSocketNotifier::Read ); connect( _sn, SIGNAL( activated(int) ), this, SLOT( readyToReceive() ) ); } return true; } |