Search in sources :

Example 6 with CommonTimer

use of im.actor.runtime.threading.CommonTimer in project actor-platform by actorapp.

the class ManagedConnection method onPongPackage.

private synchronized void onPongPackage(byte[] data) throws IOException {
    DataInput dataInput = new DataInput(data);
    int size = dataInput.readInt();
    if (size != 8) {
        Log.w(TAG, "Received incorrect pong");
        throw new IOException("Incorrect pong payload size");
    }
    long pingId = dataInput.readLong();
    // Log.d(TAG, "Received pong #" + pingId + "...");
    CommonTimer timeoutTask = schedulledPings.remove(pingId);
    if (timeoutTask == null) {
        return;
    }
    timeoutTask.cancel();
    refreshTimeouts();
}
Also used : DataInput(im.actor.runtime.bser.DataInput) CommonTimer(im.actor.runtime.threading.CommonTimer) IOException(java.io.IOException)

Example 7 with CommonTimer

use of im.actor.runtime.threading.CommonTimer in project actor-platform by actorapp.

the class ManagedConnection method onAckPackage.

// Ack
private synchronized void onAckPackage(byte[] data) throws IOException {
    DataInput ackContent = new DataInput(data);
    int frameId = ackContent.readInt();
    CommonTimer timerCompat = packageTimers.remove(frameId);
    if (timerCompat == null) {
        return;
    }
    timerCompat.cancel();
    refreshTimeouts();
}
Also used : DataInput(im.actor.runtime.bser.DataInput) CommonTimer(im.actor.runtime.threading.CommonTimer)

Aggregations

CommonTimer (im.actor.runtime.threading.CommonTimer)7 DataInput (im.actor.runtime.bser.DataInput)2 DataOutput (im.actor.runtime.bser.DataOutput)2 IOException (java.io.IOException)2 ProtoStruct (im.actor.core.network.mtp.entity.ProtoStruct)1 RpcError (im.actor.core.network.mtp.entity.rpc.RpcError)1 RpcFloodWait (im.actor.core.network.mtp.entity.rpc.RpcFloodWait)1 RpcInternalError (im.actor.core.network.mtp.entity.rpc.RpcInternalError)1 RpcOk (im.actor.core.network.mtp.entity.rpc.RpcOk)1 RpcRequest (im.actor.core.network.mtp.entity.rpc.RpcRequest)1 Response (im.actor.core.network.parser.Response)1