void KAsyncFetchObject::connectCallBack(KHttpRequest *rq,KUpstreamSelectable *client,bool half_connection) { this->client = client; if (client && client->selector==NULL) { client->selector = rq->c->selector; } if(this->client==NULL || this->client->socket->get_socket()==INVALID_SOCKET){ if (client) { client->isBad(BadStage_Connect); } if (tryCount<=conf.errorTryCount) { //connect try again retryOpen(rq); return; } handleError(rq,STATUS_GATEWAY_TIMEOUT,"Cann't connect to remote host"); return; } if (!TEST(rq->flags,RQ_NET_BIG_OBJECT)) { rq->c->removeSocket(); } if (half_connection) { client->connect(rq,resultUpstreamConnectResult); } else { sendHead(rq); } }
void AudioOutputStream::retryOpen() { #if defined(MEDIA_SERVER) if (audio != 0 && !audio->open(WriteOnly)) { if (timer == 0) { timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(retryOpen())); timer->setSingleShot(true); } if (retryCount++ < max_retry_count) timer->start(interval *= interval_multiplier); } else isOpen = true; #endif }
void KAsyncFetchObject::handleUpstreamError(KHttpRequest *rq,int error,const char *msg,int last_got) { int err = errno; char ips[MAXIPLEN]; client->socket->get_remote_ip(ips,sizeof(ips)); klog(KLOG_INFO,"rq = %p connect to %s:%d error code=%d,msg=[%s],try count=%d,last errno=[%d %s],socket=%d(%s) last_got=%d (%d %d)\n", (KSelectable *)rq, ips, client->socket->get_remote_port(), error, msg, tryCount, err, strerror(err), client->socket->get_socket(), (client->isNew()?"new":"pool"), last_got, #ifndef NDEBUG (rq->c->socket->shutdownFlag?1:0), (client->socket->shutdownFlag?1:0) #else 2,2 #endif ); assert(client); lifeTime = -1; client->isBad(badStage); SET(rq->flags,RQ_UPSTREAM_ERROR); if (badStage != BadStage_SendSuccess && tryCount>=0 && tryCount<=conf.errorTryCount) { //try again retryOpen(rq); return; } if (rq->ctx->lastModified>0 && TEST(rq->filter_flags,RF_IGNORE_ERROR)) { rq->ctx->obj->data->status_code = STATUS_NOT_MODIFIED; handleUpstreamRecvedHead(rq); return; } handleError(rq,error,msg); }
void AudioOutputStream::start( int frequency, int channels, int bitsPerSample ) { audio = new QAudioOutput( this ); audio->setFrequency( frequency ); audio->setChannels( channels ); audio->setBitsPerSample( bitsPerSample ); #if defined(MEDIA_SERVER) // Media server must relinquish the audio device { QtopiaIpcEnvelope e("QPE/MediaServer", "setPriority(int)" ); e << 1; // RingTone } retryOpen(); #else isOpen = audio->open( WriteOnly ); #endif }