mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 15:16:34 +02:00
Set nodeid directly, not as a property
This commit is contained in:
@@ -193,7 +193,7 @@ Connection::start( QTcpSocket* sock )
|
|||||||
void
|
void
|
||||||
Connection::checkACL()
|
Connection::checkACL()
|
||||||
{
|
{
|
||||||
if ( !property( "nodeid" ).isValid() )
|
if ( m_nodeid.isEmpty() )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
|
||||||
QTimer::singleShot( 0, this, SLOT( doSetup() ) );
|
QTimer::singleShot( 0, this, SLOT( doSetup() ) );
|
||||||
@@ -206,10 +206,9 @@ Connection::checkACL()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString nodeid = property( "nodeid" ).toString();
|
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking ACL for" << name();
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking ACL for" << name();
|
||||||
connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ), this, SLOT( checkACLResult( QString, QString, ACLRegistry::ACL ) ), Qt::QueuedConnection );
|
connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ), this, SLOT( checkACLResult( QString, QString, ACLRegistry::ACL ) ), Qt::QueuedConnection );
|
||||||
QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, nodeid ), Q_ARG( QString, bareName() ), Q_ARG( ACLRegistry::ACL, ACLRegistry::NotFound ) );
|
QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, m_nodeid ), Q_ARG( QString, bareName() ), Q_ARG( ACLRegistry::ACL, ACLRegistry::NotFound ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -222,9 +221,9 @@ Connection::bareName() const
|
|||||||
void
|
void
|
||||||
Connection::checkACLResult( const QString &nodeid, const QString &username, ACLRegistry::ACL peerStatus )
|
Connection::checkACLResult( const QString &nodeid, const QString &username, ACLRegistry::ACL peerStatus )
|
||||||
{
|
{
|
||||||
if ( nodeid != property( "nodeid" ).toString() )
|
if ( nodeid != m_nodeid )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "nodeid (%1) not ours (%2) for user %3" ).arg( nodeid ).arg( property( "nodeid" ).toString() ).arg( username );
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "nodeid (%1) not ours (%2) for user %3" ).arg( nodeid ).arg( m_nodeid ).arg( username );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( username != bareName() )
|
if ( username != bareName() )
|
||||||
@@ -368,6 +367,18 @@ Connection::setId( const QString& id )
|
|||||||
m_id = id;
|
m_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
Connection::nodeId() const
|
||||||
|
{
|
||||||
|
return m_nodeid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Connection::setNodeId( const QString& nodeid )
|
||||||
|
{
|
||||||
|
m_nodeid = nodeid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Connection::readyRead()
|
Connection::readyRead()
|
||||||
|
@@ -58,6 +58,9 @@ public:
|
|||||||
QString id() const;
|
QString id() const;
|
||||||
void setId( const QString& );
|
void setId( const QString& );
|
||||||
|
|
||||||
|
QString nodeId() const;
|
||||||
|
void setNodeId( const QString& );
|
||||||
|
|
||||||
void setFirstMessage( const QVariant& m );
|
void setFirstMessage( const QVariant& m );
|
||||||
void setFirstMessage( msg_ptr m );
|
void setFirstMessage( msg_ptr m );
|
||||||
msg_ptr firstMessage() const { return m_firstmsg; }
|
msg_ptr firstMessage() const { return m_firstmsg; }
|
||||||
@@ -145,6 +148,7 @@ private:
|
|||||||
qint64 m_tx_bytes, m_tx_bytes_requested;
|
qint64 m_tx_bytes, m_tx_bytes_requested;
|
||||||
qint64 m_rx_bytes;
|
qint64 m_rx_bytes;
|
||||||
QString m_id;
|
QString m_id;
|
||||||
|
QString m_nodeid;
|
||||||
|
|
||||||
QTimer* m_statstimer;
|
QTimer* m_statstimer;
|
||||||
QTime m_statstimer_mark;
|
QTime m_statstimer_mark;
|
||||||
|
@@ -243,7 +243,7 @@ ConnectionManager::connectToPeer( const Tomahawk::peerinfo_ptr &peerInfo, bool l
|
|||||||
if ( peerInfo->nodeId().length() )
|
if ( peerInfo->nodeId().length() )
|
||||||
d_func()->controlConnection->setId( peerInfo->nodeId() );
|
d_func()->controlConnection->setId( peerInfo->nodeId() );
|
||||||
|
|
||||||
d_func()->controlConnection->setProperty( "nodeid", peerInfo->nodeId() );
|
d_func()->controlConnection->setNodeId( peerInfo->nodeId() );
|
||||||
|
|
||||||
Servent::instance()->registerControlConnection( d_func()->controlConnection.data() );
|
Servent::instance()->registerControlConnection( d_func()->controlConnection.data() );
|
||||||
tryConnect();
|
tryConnect();
|
||||||
|
@@ -1105,7 +1105,7 @@ Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString
|
|||||||
{
|
{
|
||||||
// Used by the connection for the ACL check
|
// Used by the connection for the ACL check
|
||||||
// If there isn't a nodeid it's not the first connection and will already have been stopped
|
// If there isn't a nodeid it's not the first connection and will already have been stopped
|
||||||
conn.data()->setProperty( "nodeid", nodeid );
|
conn->setNodeId( nodeid );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( conn.data()->onceOnly() )
|
if ( conn.data()->onceOnly() )
|
||||||
|
Reference in New Issue
Block a user