Moving the untrustedMode setting into the marshalling ops

This commit is contained in:
Viktor Klang 2011-11-24 10:38:36 +01:00
parent abcaf01525
commit 4a64428e48
2 changed files with 10 additions and 6 deletions

View file

@ -277,6 +277,8 @@ trait RemoteMarshallingOps {
def system: ActorSystem
protected def useUntrustedMode: Boolean
def createMessageSendEnvelope(rmp: RemoteMessageProtocol): AkkaRemoteProtocol = {
val arp = AkkaRemoteProtocol.newBuilder
arp.setMessage(rmp)
@ -319,15 +321,15 @@ trait RemoteMarshallingOps {
messageBuilder
}
def receiveMessage(remoteMessage: RemoteMessage, untrustedMode: Boolean) {
def receiveMessage(remoteMessage: RemoteMessage) {
val recipient = remoteMessage.recipient
remoteMessage.payload match {
case Left(t) throw t
case Right(r) r match {
case _: Terminate if (untrustedMode) throw new SecurityException("RemoteModule server is operating is untrusted mode, can not stop the actor") else recipient.stop()
case _: AutoReceivedMessage if (untrustedMode) throw new SecurityException("RemoteModule server is operating is untrusted mode, can not pass on a AutoReceivedMessage to the remote actor")
case m recipient.!(m)(remoteMessage.sender)
case _: Terminate if (useUntrustedMode) throw new SecurityException("RemoteModule server is operating is untrusted mode, can not stop the actor") else recipient.stop()
case _: AutoReceivedMessage if (useUntrustedMode) throw new SecurityException("RemoteModule server is operating is untrusted mode, can not pass on a AutoReceivedMessage to the remote actor")
case m recipient.!(m)(remoteMessage.sender)
}
}
}