mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Fix psadmin, artifact upload
This commit is contained in:
parent
cf9e4ea194
commit
06e63dd960
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
|
|
@ -43,4 +43,4 @@ jobs:
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: server.zip
|
name: server.zip
|
||||||
path: server/target/server*.zip
|
path: server/target/psforever-server-*.zip
|
||||||
|
|
@ -2,7 +2,8 @@ package net.psforever.login.psadmin
|
||||||
|
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
|
|
||||||
import akka.actor.{Actor, ActorRef, Props, Stash}
|
import akka.actor.typed.receptionist.Receptionist
|
||||||
|
import akka.actor.{Actor, ActorRef, Props, Stash, typed}
|
||||||
import akka.io.Tcp
|
import akka.io.Tcp
|
||||||
import akka.util.ByteString
|
import akka.util.ByteString
|
||||||
import org.json4s._
|
import org.json4s._
|
||||||
|
|
@ -11,8 +12,8 @@ import scodec.bits._
|
||||||
import scodec.interop.akka._
|
import scodec.interop.akka._
|
||||||
import net.psforever.services.ServiceManager.Lookup
|
import net.psforever.services.ServiceManager.Lookup
|
||||||
import net.psforever.services._
|
import net.psforever.services._
|
||||||
|
|
||||||
import scala.collection.mutable.Map
|
import scala.collection.mutable.Map
|
||||||
|
import akka.actor.typed.scaladsl.adapter._
|
||||||
|
|
||||||
object PsAdminActor {
|
object PsAdminActor {
|
||||||
val whiteSpaceRegex = """\s+""".r
|
val whiteSpaceRegex = """\s+""".r
|
||||||
|
|
@ -21,25 +22,34 @@ object PsAdminActor {
|
||||||
class PsAdminActor(peerAddress: InetSocketAddress, connection: ActorRef) extends Actor with Stash {
|
class PsAdminActor(peerAddress: InetSocketAddress, connection: ActorRef) extends Actor with Stash {
|
||||||
private[this] val log = org.log4s.getLogger(self.path.name)
|
private[this] val log = org.log4s.getLogger(self.path.name)
|
||||||
|
|
||||||
val services = Map[String, ActorRef]()
|
var cluster: typed.ActorRef[InterstellarClusterService.Command] = null
|
||||||
val servicesToResolve = Array("cluster")
|
|
||||||
var buffer = ByteString()
|
// val services = Map[String, ActorRef]()
|
||||||
|
// val servicesToResolve = Array("cluster")
|
||||||
|
var buffer = ByteString()
|
||||||
|
|
||||||
implicit val formats = DefaultFormats // for JSON serialization
|
implicit val formats = DefaultFormats // for JSON serialization
|
||||||
|
|
||||||
case class CommandCall(operation: String, args: Array[String])
|
case class CommandCall(operation: String, args: Array[String])
|
||||||
|
|
||||||
|
ServiceManager.receptionist ! Receptionist.Find(
|
||||||
|
InterstellarClusterService.InterstellarClusterServiceKey,
|
||||||
|
context.self
|
||||||
|
)
|
||||||
|
|
||||||
override def preStart() = {
|
override def preStart() = {
|
||||||
log.trace(s"PsAdmin connection started $peerAddress")
|
log.trace(s"PsAdmin connection started $peerAddress")
|
||||||
|
|
||||||
for (service <- servicesToResolve) {
|
|
||||||
ServiceManager.serviceManager ! Lookup(service)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def receive = ServiceLookup
|
override def receive = ServiceLookup
|
||||||
|
|
||||||
def ServiceLookup: Receive = {
|
def ServiceLookup: Receive = {
|
||||||
|
case InterstellarClusterService.InterstellarClusterServiceKey.Listing(listings) =>
|
||||||
|
cluster = listings.head
|
||||||
|
unstashAll()
|
||||||
|
context.become(ReceiveCommand)
|
||||||
|
|
||||||
|
/*
|
||||||
case ServiceManager.LookupResult(service, endpoint) =>
|
case ServiceManager.LookupResult(service, endpoint) =>
|
||||||
services { service } = endpoint
|
services { service } = endpoint
|
||||||
|
|
||||||
|
|
@ -47,6 +57,7 @@ class PsAdminActor(peerAddress: InetSocketAddress, connection: ActorRef) extends
|
||||||
unstashAll()
|
unstashAll()
|
||||||
context.become(ReceiveCommand)
|
context.become(ReceiveCommand)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
case default => stash()
|
case default => stash()
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +142,7 @@ class PsAdminActor(peerAddress: InetSocketAddress, connection: ActorRef) extends
|
||||||
|
|
||||||
cmd_template match {
|
cmd_template match {
|
||||||
case PsAdminCommands.Command(usage, handler) =>
|
case PsAdminCommands.Command(usage, handler) =>
|
||||||
context.actorOf(Props(handler, args, services))
|
context.actorOf(Props(handler, args, Map[String, ActorRef]()))
|
||||||
|
|
||||||
case PsAdminCommands.CommandInternal(usage, handler) =>
|
case PsAdminCommands.CommandInternal(usage, handler) =>
|
||||||
val resp = handler(args)
|
val resp = handler(args)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue