HttpServer::HttpServer( QAbstractSocket * parent ) : Protocol( parent, defaultTimeout ), state( ReadingHeader ) { #ifdef DEBUG_XMLRPC qDebug() << this << "HttpServer():" << parent; #endif connect( socket, SIGNAL( readyRead() ), this, SLOT( slotReadyRead() ) ); connect( socket, SIGNAL( bytesWritten(qint64) ), this, SLOT( slotBytesWritten(qint64) ) ); #ifndef QT_NO_OPENSSL if ( socket->inherits( "QSslSocket" ) ) { QSslSocket *sslServer = qobject_cast<QSslSocket *>( socket ); sslServer->startServerEncryption(); } else { if ( socket->bytesAvailable() > 0 ) { slotReadyRead(); } } #else if ( socket->bytesAvailable() > 0 ) { slotReadyRead(); } #endif }
void SIMClientSocket::write(const char *buf, unsigned int size) { bInWrite = true; int res = sock->writeBlock(buf, size); bInWrite = false; if (res != (int)size){ if (notify) notify->error_state("Write socket error"); return; } if (sock->bytesToWrite() == 0) QTimer::singleShot(0, this, SLOT(slotBytesWritten())); }
bool QHttp::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: abort(); break; case 1: clientReply((const QHttpResponseHeader&)*((const QHttpResponseHeader*)static_QUType_ptr.get(_o+1))); break; case 2: clientDone((bool)static_QUType_bool.get(_o+1)); break; case 3: clientStateChanged((int)static_QUType_int.get(_o+1)); break; case 4: startNextRequest(); break; case 5: slotReadyRead(); break; case 6: slotConnected(); break; case 7: slotError((int)static_QUType_int.get(_o+1)); break; case 8: slotClosed(); break; case 9: slotBytesWritten((int)static_QUType_int.get(_o+1)); break; default: return QNetworkProtocol::qt_invoke( _id, _o ); } return TRUE; }
void SIMClientSocket::pause(unsigned t) { QTimer::singleShot(t * 1000, this, SLOT(slotBytesWritten())); }
void SIMClientSocket::slotBytesWritten(int) { slotBytesWritten(); }