mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-07 17:42:35 +02:00
* Added assert to catch dupe source.
This commit is contained in:
parent
b252418074
commit
f78df2c087
@ -75,6 +75,13 @@ ControlConnection::setup()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << id() << name();
|
||||
|
||||
if ( !m_source.isNull() )
|
||||
{
|
||||
qDebug() << "This source seems to be online already.";
|
||||
Q_ASSERT( false );
|
||||
return;
|
||||
}
|
||||
|
||||
QString friendlyName;
|
||||
if ( Servent::isIPWhitelisted( m_sock->peerAddress() ) )
|
||||
{
|
||||
@ -85,7 +92,7 @@ ControlConnection::setup()
|
||||
}
|
||||
else
|
||||
friendlyName = name();
|
||||
|
||||
|
||||
// setup source and remote collection for this peer
|
||||
m_source = SourceList::instance()->get( id(), friendlyName );
|
||||
m_source->setControlConnection( this );
|
||||
|
@ -30,7 +30,7 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
Source::Source( int id, const QString &username )
|
||||
Source::Source( int id, const QString& username )
|
||||
: QObject()
|
||||
, m_isLocal( false )
|
||||
, m_online( false )
|
||||
@ -38,7 +38,7 @@ Source::Source( int id, const QString &username )
|
||||
, m_id( id )
|
||||
, m_cc( 0 )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << Q_FUNC_INFO << id << username;
|
||||
|
||||
if ( id == 0 )
|
||||
{
|
||||
@ -146,6 +146,7 @@ Source::setOnline()
|
||||
{
|
||||
if ( m_online )
|
||||
return;
|
||||
m_online = true;
|
||||
|
||||
// ensure username is in the database
|
||||
DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_username, m_friendlyname );
|
||||
@ -153,7 +154,6 @@ Source::setOnline()
|
||||
SLOT( dbLoaded( unsigned int, const QString& ) ) );
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
|
||||
m_online = true;
|
||||
emit online();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user