Search in sources :

Example 6 with ProtoStruct

use of im.actor.core.network.mtp.entity.ProtoStruct in project actor-platform by actorapp.

the class AuthKeyActor method goToState.

private void goToState(ActorState state) {
    currentState = state;
    if (connection != null) {
        try {
            ProtoStruct struct = currentState.sendStartMessage();
            byte[] data = new ProtoPackage(0, 0, new ProtoMessage(0, struct.toByteArray())).toByteArray();
            connection.post(data, 0, data.length);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : ProtoStruct(im.actor.core.network.mtp.entity.ProtoStruct) ProtoMessage(im.actor.core.network.mtp.entity.ProtoMessage) ProtoPackage(im.actor.core.network.mtp.entity.ProtoPackage) IOException(java.io.IOException)

Example 7 with ProtoStruct

use of im.actor.core.network.mtp.entity.ProtoStruct in project actor-platform by actorapp.

the class AuthKeyActor method onConnectionStarted.

// 
// Message Processing
// 
private void onConnectionStarted() {
    try {
        if (currentState == null) {
            throw new IOException();
        }
        ProtoStruct struct = currentState.sendStartMessage();
        byte[] data = new ProtoPackage(0, 0, new ProtoMessage(0, struct.toByteArray())).toByteArray();
        connection.post(data, 0, data.length);
    } catch (Exception e) {
        e.printStackTrace();
        crashConnection();
    }
}
Also used : ProtoStruct(im.actor.core.network.mtp.entity.ProtoStruct) ProtoMessage(im.actor.core.network.mtp.entity.ProtoMessage) IOException(java.io.IOException) ProtoPackage(im.actor.core.network.mtp.entity.ProtoPackage) IOException(java.io.IOException)

Aggregations

ProtoStruct (im.actor.core.network.mtp.entity.ProtoStruct)7 IOException (java.io.IOException)7 ProtoMessage (im.actor.core.network.mtp.entity.ProtoMessage)3 ProtoPackage (im.actor.core.network.mtp.entity.ProtoPackage)3 AuthIdInvalid (im.actor.core.network.mtp.entity.AuthIdInvalid)1 Container (im.actor.core.network.mtp.entity.Container)1 MTPush (im.actor.core.network.mtp.entity.MTPush)1 MTRpcResponse (im.actor.core.network.mtp.entity.MTRpcResponse)1 MessageAck (im.actor.core.network.mtp.entity.MessageAck)1 NewSessionCreated (im.actor.core.network.mtp.entity.NewSessionCreated)1 RequestDH (im.actor.core.network.mtp.entity.RequestDH)1 RequestResend (im.actor.core.network.mtp.entity.RequestResend)1 ResponseDoDH (im.actor.core.network.mtp.entity.ResponseDoDH)1 SessionLost (im.actor.core.network.mtp.entity.SessionLost)1 UnsentMessage (im.actor.core.network.mtp.entity.UnsentMessage)1 UnsentResponse (im.actor.core.network.mtp.entity.UnsentResponse)1 Push (im.actor.core.network.mtp.entity.rpc.Push)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