Merge branch 'dev' into variable-rate-polling

This commit is contained in:
Niels Andriesse
2021-05-21 10:07:41 +10:00
7 changed files with 26 additions and 17 deletions

View File

@@ -158,7 +158,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
.putString(THREAD_ID_KEY, threadID)
.putByteArray(MESSAGE_KEY, serializedMessage)
.putString(MESSAGE_SEND_JOB_ID_KEY, messageSendJobID)
.build();
.build()
}
override fun getFactoryKey(): String {
@@ -172,7 +172,7 @@ class AttachmentUploadJob(val attachmentID: Long, val threadID: String, val mess
val kryo = Kryo()
kryo.isRegistrationRequired = false
val input = Input(serializedMessage)
val message: Message = kryo.readObject(input, Message::class.java)
val message = kryo.readObject(input, Message::class.java)
input.close()
return AttachmentUploadJob(
data.getLong(ATTACHMENT_ID_KEY),

View File

@@ -88,17 +88,16 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
override fun serialize(): Data {
val kryo = Kryo()
kryo.isRegistrationRequired = false
val output = Output(ByteArray(4096), MAX_BUFFER_SIZE)
// Message
kryo.writeClassAndObject(output, message)
output.close()
val serializedMessage = output.toBytes()
output.clear()
val messageOutput = Output(ByteArray(4096), MAX_BUFFER_SIZE)
kryo.writeClassAndObject(messageOutput, message)
messageOutput.close()
val serializedMessage = messageOutput.toBytes()
// Destination
kryo.writeClassAndObject(output, destination)
output.close()
val serializedDestination = output.toBytes()
output.clear()
val destinationOutput = Output(ByteArray(4096), MAX_BUFFER_SIZE)
kryo.writeClassAndObject(destinationOutput, destination)
destinationOutput.close()
val serializedDestination = destinationOutput.toBytes()
// Serialize
return Data.Builder()
.putByteArray(MESSAGE_KEY, serializedMessage)
@@ -116,6 +115,7 @@ class MessageSendJob(val message: Message, val destination: Destination) : Job {
val serializedMessage = data.getByteArray(MESSAGE_KEY)
val serializedDestination = data.getByteArray(DESTINATION_KEY)
val kryo = Kryo()
kryo.isRegistrationRequired = false
// Message
val messageInput = Input(serializedMessage)
val message: Message

View File

@@ -67,7 +67,9 @@ class NotifyPNServerJob(val message: SnodeMessage) : Job {
val output = Output(serializedMessage)
kryo.writeObject(output, message)
output.close()
return Data.Builder().putByteArray(MESSAGE_KEY, serializedMessage).build();
return Data.Builder()
.putByteArray(MESSAGE_KEY, serializedMessage)
.build();
}
override fun getFactoryKey(): String {
@@ -81,7 +83,7 @@ class NotifyPNServerJob(val message: SnodeMessage) : Job {
val kryo = Kryo()
kryo.isRegistrationRequired = false
val input = Input(serializedMessage)
val message: SnodeMessage = kryo.readObject(input, SnodeMessage::class.java)
val message = kryo.readObject(input, SnodeMessage::class.java)
input.close()
return NotifyPNServerJob(message)
}