コード例 #1
0
void ClientStream::processNext()
{
	if( !d->in.isEmpty() )
	{
		QTimer::singleShot(0, this, SLOT(doReadyRead()));
	}
}
コード例 #2
0
void ClientStream::cp_incomingData()
{
// 	kdDebug(YAHOO_RAW_DEBUG) ;
	Transfer * incoming = d->client.incomingTransfer();
	if ( incoming )
	{
// 		kdDebug(YAHOO_RAW_DEBUG) << " - got a new transfer";
		d->in.enqueue( incoming );
		d->newTransfers = true;
		emit doReadyRead();
	}
	else
		kdDebug(YAHOO_RAW_DEBUG) << " - client signalled incomingData but none was available, state is: "<< d->client.state() << endl;
}
コード例 #3
0
void ClientStream::cp_incomingData()
{
	Transfer * incoming = d->client.incomingTransfer();
	if ( incoming )
	{
		d->in.enqueue( incoming );
		d->newTransfers = true;
		doReadyRead();
	}
	else
		kDebug(OSCAR_RAW_DEBUG) << 
			"client signalled incomingData but none was available, state is: " <<
			d->client.state() << endl;
}
コード例 #4
0
void LinkLocal::Stream::error(int)
{
	while(!waiting.isEmpty()) {
		Stanza s = waiting.first();
		Jid recp = s.to();
		s.setTo(s.from());
		s.setFrom(recp);
		s.setType("error");
		s.setError(Stanza::Error(Stanza::Error::Cancel, Stanza::Error::ServiceUnavailable, "Cound not connect to recipient!"));
		in.append(new Stanza(s));
		waiting.removeFirst();
	}
	doReadyRead();
	emit cleanUp(this);
	deleteLater();
}
コード例 #5
0
void LinkLocal::Stream::processNext()
{
	while(1) {
//		printf("################# %s\n", (proto->c2c_local) ? "Client" : "Server" );
		bool ok = proto->processStep();
		if(!ok && proto->need!=CoreProtocol::NSASLMechs && state!=WaitTLS) {
//			printf("pased: %d\n", ok ? 1 : 0);
			int need = proto->need;
//			printf("need: %d\n", need);
			if(need == CoreProtocol::NSASLMechs) {
				QStringList list;
				proto->setSASLMechList(list);
				return;
			}

			if(!in.isEmpty()) {
// 				printf("in not empty\n");
				QTimer::singleShot(0, this, SLOT(doReadyRead()));
			}

		return;
		}

		int event = proto->event;
// 		printf("event: %d\n", event);
		switch(event) {
			case CoreProtocol::EError: {
// 				printf("Error! Code=%d\n", proto->errorCode);
//				handleError();
				return;
			}
			case CoreProtocol::ESend: {
				QByteArray a = proto->takeOutgoingData();
				QByteArray cs(a.size()+1,'\0');
				memcpy(cs.data(), a.data(), a.size());
// 				printf("Need Send: {%s}\n", cs.data());
				bs_->write(a);
				break;
			}
			case CoreProtocol::ERecvOpen: {
// 				printf("Break (RecvOpen)\n");
				if(proto->old) {
					state = WaitVersion;
// 					printf("WarnOldVersion\n");
					return;
				}
				break;
			}
			case CoreProtocol::EFeatures: {
// 				printf("Break (Features)\n");
				if(state == WaitTLS)
					state = Active;
				else
					state = WaitTLS;
				break;
			}
			case CoreProtocol::ESASLSuccess: {
// 				printf("Break SASL Success\n");
				break;
			}
			case CoreProtocol::EReady: {
// 				printf("Done!\n");
				state = Active;
				ready();
				break;
			}
			case CoreProtocol::EPeerClosed: {
//				printf("DocumentClosed\n");
//				reset();
//				connectionClosed();
				return;
			}
			case CoreProtocol::EStanzaReady: {
//				printf("StanzaReady\n");
				// store the stanza for now, announce after processing all events
				Stanza s = createStanza(proto->recvStanza());
				if(s.isNull())
					break;
				in.append(new Stanza(s));
				break;
			}
			case CoreProtocol::EStanzaSent: {
//				printf("StanzasSent\n");
//				stanzaWritten();
//				if(!self)
//					return;
				break;
			}
			case CoreProtocol::EClosed: {
//				printf("Closed\n");
//				reset();
//				delayedCloseFinished();
				return;
			}
		}
	}
}