summaryrefslogtreecommitdiff
path: root/core/launcher/transferserver.cpp
Unidiff
Diffstat (limited to 'core/launcher/transferserver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index b998e95..a5e20b2 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -64,44 +64,44 @@ TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
64 : QServerSocket( port, 1, parent, name ) 64 : QServerSocket( port, 1, parent, name )
65{ 65{
66 connections.setAutoDelete( TRUE ); 66 connections.setAutoDelete( TRUE );
67 if ( !ok() ) 67 if ( !ok() )
68 qWarning( "Failed to bind to port %d", port ); 68 qWarning( "Failed to bind to port %d", port );
69} 69}
70 70
71void TransferServer::authorizeConnections() 71void TransferServer::authorizeConnections()
72{ 72{
73 QListIterator<ServerPI> it(connections); 73 QListIterator<ServerPI> it(connections);
74 while ( it.current() ) { 74 while ( it.current() ) {
75 if ( !it.current()->verifyAuthorised() ) { 75 if ( !it.current()->verifyAuthorised() ) {
76 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 76 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) );
77 connections.removeRef( it.current() ); 77 connections.removeRef( it.current() );
78 } else 78 } else
79 ++it; 79 ++it;
80 } 80 }
81} 81}
82 82
83void TransferServer::closed(ServerPI *item) 83void TransferServer::closed(ServerPI *item)
84{ 84{
85 connections.removeRef(item); 85 connections.removeRef(item);
86} 86}
87 87
88TransferServer::~TransferServer() 88TransferServer::~TransferServer()
89{ 89{
90} 90}
91 91
92void TransferServer::newConnection( int socket ) 92void TransferServer::newConnection( int socket )
93{ 93{
94 ServerPI *ptr = new ServerPI( socket, this ); 94 ServerPI *ptr = new ServerPI( socket, this );
95 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 95 connect( ptr, SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) );
96 connections.append( ptr ); 96 connections.append( ptr );
97} 97}
98 98
99QString SyncAuthentication::serverId() 99QString SyncAuthentication::serverId()
100{ 100{
101 Config cfg("Security"); 101 Config cfg("Security");
102 cfg.setGroup("Sync"); 102 cfg.setGroup("Sync");
103 QString r = cfg.readEntry("serverid"); 103 QString r = cfg.readEntry("serverid");
104 104
105 if ( r.isEmpty() ) { 105 if ( r.isEmpty() ) {
106 r = OGlobal::generateUuid(); 106 r = OGlobal::generateUuid();
107 cfg.writeEntry("serverid", r ); 107 cfg.writeEntry("serverid", r );
@@ -324,37 +324,37 @@ ServerPI::ServerPI( int socket, QObject *parent, const char* name )
324 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 324 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
325 325
326 passiv = FALSE; 326 passiv = FALSE;
327 for( int i = 0; i < 4; i++ ) 327 for( int i = 0; i < 4; i++ )
328 wait[i] = FALSE; 328 wait[i] = FALSE;
329 329
330 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr 330 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr
331 state = Wait_USER; 331 state = Wait_USER;
332 332
333 dtp = new ServerDTP( this ); 333 dtp = new ServerDTP( this );
334 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); 334 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
335 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); 335 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
336 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); 336 connect( dtp, SIGNAL( error(int) ), SLOT( dtpError(int) ) );
337 337
338 338
339 directory = QDir::currentDirPath(); 339 directory = QDir::currentDirPath();
340 340
341 static int p = 1024; 341 static int p = 1024;
342 342
343 while ( !serversocket || !serversocket->ok() ) { 343 while ( !serversocket || !serversocket->ok() ) {
344 delete serversocket; 344 delete serversocket;
345 serversocket = new ServerSocket( ++p, this ); 345 serversocket = new ServerSocket( ++p, this );
346 } 346 }
347 connect( serversocket, SIGNAL( newIncomming( int ) ), 347 connect( serversocket, SIGNAL( newIncomming(int) ),
348 SLOT( newConnection( int ) ) ); 348 SLOT( newConnection(int) ) );
349 } 349 }
350} 350}
351 351
352ServerPI::~ServerPI() 352ServerPI::~ServerPI()
353{ 353{
354 close(); 354 close();
355 355
356 if ( dtp ) 356 if ( dtp )
357 dtp->close(); 357 dtp->close();
358 delete dtp; 358 delete dtp;
359 delete serversocket; 359 delete serversocket;
360} 360}
@@ -1077,25 +1077,25 @@ void ServerPI::timerEvent( QTimerEvent * )
1077{ 1077{
1078 connectionClosed(); 1078 connectionClosed();
1079} 1079}
1080 1080
1081 1081
1082ServerDTP::ServerDTP( QObject *parent, const char* name) 1082ServerDTP::ServerDTP( QObject *parent, const char* name)
1083 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), 1083 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
1084 retrieveTargzProc( 0 ) 1084 retrieveTargzProc( 0 )
1085{ 1085{
1086 1086
1087 connect( this, SIGNAL( connected() ), SLOT( connected() ) ); 1087 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
1088 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 1088 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
1089 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); 1089 connect( this, SIGNAL( bytesWritten(int) ), SLOT( bytesWritten(int) ) );
1090 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); 1090 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
1091 1091
1092 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr 1092 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr
1093 createTargzProc->setCommunication( QProcess::Stdout ); 1093 createTargzProc->setCommunication( QProcess::Stdout );
1094 createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1094 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1095 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); 1095 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) );
1096 1096
1097 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" ); 1097 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" );
1098 retrieveTargzProc->setCommunication( QProcess::Stdin ); 1098 retrieveTargzProc->setCommunication( QProcess::Stdin );
1099 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1099 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1100 connect( retrieveTargzProc, SIGNAL( processExited() ), 1100 connect( retrieveTargzProc, SIGNAL( processExited() ),
1101 SIGNAL( completed() ) ); 1101 SIGNAL( completed() ) );