Commit d02cc713 authored by Michał Małek's avatar Michał Małek
Browse files

Ported KSocketFactory to a plain QTcpSocket

parent c7feb4e9
......@@ -22,8 +22,6 @@
#include "asynccddbplookup.h"
#include "logging.h"
#include <ksocketfactory.h>
namespace KCDDB
{
AsyncCDDBPLookup::AsyncCDDBPLookup()
......@@ -45,7 +43,8 @@ namespace KCDDB
const TrackOffsetList & trackOffsetList
)
{
socket_ = KSocketFactory::connectToHost(QLatin1String( "cddbp" ), hostname, port);
socket_ = new QTcpSocket;
socket_->connectToHost(hostname, port);
connect (socket_, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotGotError(QAbstractSocket::SocketError)));
......
......@@ -22,8 +22,7 @@
#include "synccddbplookup.h"
#include "logging.h"
#include <qstringlist.h>
#include <ksocketfactory.h>
#include <QtCore/QStringList>
namespace KCDDB
{
......@@ -47,12 +46,13 @@ namespace KCDDB
{
trackOffsetList_ = trackOffsetList;
socket_ = KSocketFactory::synchronousConnectToHost(QLatin1String( "cddbp" ), hostName, port);
socket_ = new QTcpSocket;
socket_->connectToHost(hostName, port);
if ( !socket_->isValid() )
if ( !socket_->waitForConnected(30000) )
{
qCDebug(LIBKCDDB) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort();
qCDebug(LIBKCDDB) << "Socket error: " << socket_->errorString();
qCDebug(LIBKCDDB) << "Couldn't connect to " << socket_->peerName() << ":" << socket_->peerPort();
qCDebug(LIBKCDDB) << "Socket error: " << socket_->errorString();
if ( socket_->error() == QAbstractSocket::HostNotFoundError )
return HostNotFound;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment