package ccf.session

import scala.actors.Actor
import ccf.transport.Connection

class SessionActor(connection: Connection, clientId: ClientId, version: Version, session: Session) extends Actor {
  start
  def this(connection: Connection, clientId: ClientId, version: Version) = {
    this(connection, clientId, version, Session(connection, version, clientId, 0, Set()))
  }
  def act { loop(session) }
  private def loop(s: Session) { react {
    case msg: Message => {
      val nextSession = handleMessage(s, msg)
      loop(nextSession)
    }
    case Shutdown => exit
  }}
  private def handleMessage(session: Session, msg: Message): Session = session.send(msg) match {
    case (nextSession: Session, result: Either[Failure, Success]) => {
      sender ! result
      nextSession
    }
  }
}

package ccf.session

import scala.actors.Actor
import ccf.transport.Connection

class SessionActor(connection: Connection, clientId: ClientId, version: Version, session: Session) extends Actor {
  start
  def this(connection: Connection, clientId: ClientId, version: Version) = {
    this(connection, clientId, version, Session(connection, version, clientId, 0, Set()))
  }
  def act { loop(session) }
  private def loop(s: Session) { react {
    case msg: Message => {
      val nextSession = handleMessage(s, msg)
      loop(nextSession)
    }
    case Shutdown => exit
  }}
  private def handleMessage(session: Session, msg: Message): Session = session.send(msg) match {
    case (nextSession: Session, result: Either[Failure, Success]) => { sender ! result; nextSession }
  }
}

--- 
+++ 
@@ -17,6 +17,9 @@
     case Shutdown => exit
   }}
   private def handleMessage(session: Session, msg: Message): Session = session.send(msg) match {
-    case (nextSession: Session, result: Either[Failure, Success]) => { sender ! result; nextSession }
+    case (nextSession: Session, result: Either[Failure, Success]) => {
+      sender ! result
+      nextSession
+    }
   }
 }
session: Split code to two lines for clarity

Style where ';' is used to put several lines of code into same line is
harder to read, especialle when we already have quite a long matcher in
the same line.

Signed-off-by: Aki Saarinen <2c8035bb80cf98a391872dcbe797b269d759f6d9@reaktor.fi>
