mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
Set nodeid directly, not as a property
This commit is contained in:
parent
9d702e0189
commit
2f570ef161
@ -193,7 +193,7 @@ Connection::start( QTcpSocket* sock )
|
||||
void
|
||||
Connection::checkACL()
|
||||
{
|
||||
if ( !property( "nodeid" ).isValid() )
|
||||
if ( m_nodeid.isEmpty() )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
|
||||
QTimer::singleShot( 0, this, SLOT( doSetup() ) );
|
||||
@ -206,10 +206,9 @@ Connection::checkACL()
|
||||
return;
|
||||
}
|
||||
|
||||
QString nodeid = property( "nodeid" ).toString();
|
||||
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 );
|
||||
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
|
||||
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;
|
||||
}
|
||||
if ( username != bareName() )
|
||||
@ -368,6 +367,18 @@ Connection::setId( const QString& id )
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QString
|
||||
Connection::nodeId() const
|
||||
{
|
||||
return m_nodeid;
|
||||
}
|
||||
|
||||
void
|
||||
Connection::setNodeId( const QString& nodeid )
|
||||
{
|
||||
m_nodeid = nodeid;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Connection::readyRead()
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
QString id() const;
|
||||
void setId( const QString& );
|
||||
|
||||
QString nodeId() const;
|
||||
void setNodeId( const QString& );
|
||||
|
||||
void setFirstMessage( const QVariant& m );
|
||||
void setFirstMessage( msg_ptr m );
|
||||
msg_ptr firstMessage() const { return m_firstmsg; }
|
||||
@ -145,6 +148,7 @@ private:
|
||||
qint64 m_tx_bytes, m_tx_bytes_requested;
|
||||
qint64 m_rx_bytes;
|
||||
QString m_id;
|
||||
QString m_nodeid;
|
||||
|
||||
QTimer* m_statstimer;
|
||||
QTime m_statstimer_mark;
|
||||
|
@ -243,7 +243,7 @@ ConnectionManager::connectToPeer( const Tomahawk::peerinfo_ptr &peerInfo, bool l
|
||||
if ( peerInfo->nodeId().length() )
|
||||
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() );
|
||||
tryConnect();
|
||||
|
@ -1105,7 +1105,7 @@ Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString
|
||||
{
|
||||
// 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
|
||||
conn.data()->setProperty( "nodeid", nodeid );
|
||||
conn->setNodeId( nodeid );
|
||||
}
|
||||
|
||||
if ( conn.data()->onceOnly() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user