Permalink
Browse files

Connected the swank layer to the client protocol

  • Loading branch information...
djspiewak committed Nov 9, 2011
1 parent d779432 commit f3049b1335fb66dbb326d1bb89cde59cd4b959d4
Showing with 18 additions and 1 deletion.
  1. +18 −1 agent/src/main/scala/com/codecommit/cccp/agent/SwankProtocol.scala
@@ -1,7 +1,7 @@
package com.codecommit.cccp
package agent
-import akka.actor.Actor
+import akka.actor.{Actor, ActorRef}
import java.net.Socket
import java.util.UUID
@@ -23,7 +23,24 @@ class SwankProtocol(socket: Socket) extends Actor {
val agent = new AsyncSocketAgent(socket, receiveData, { _ => }) // TODO error handling
+ @volatile
+ var channel: ActorRef = _
+
+ @volatile
+ var files = Map[String, ActorRef]()
+
def receive = {
+ case InitConnection(protocol, host, port) =>
+ channel = actorOf(new ServerChannel(protocol, host, port))
+
+ case LinkFile(id, fileName) => {
+ if (channel != null) {
+ files = files.updated(fileName, actorOf(new ClientFileActor(id, fileName, self, channel)))
+ }
+ }
+
+ case EditFile(fileName, op) => files get fileName foreach { _ ! op }
+
case EditPerformed(fileName, op) =>
}

0 comments on commit f3049b1

Please sign in to comment.