Skip to content

Commit

Permalink
Update for newest transferpe package.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extollite committed Nov 8, 2020
1 parent a762c18 commit 7738df3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "96db8838be60fcbb993fa738e1120fb7f4b99c43",
"version": "2.22.1"
"revision": "c3e2359c55cd8b47207ab7363b77c9c398a95294",
"version": "2.23.0"
}
},
{
"package": "swift-raknet",
"repositoryURL": "https://github.com/Extollite/swift-raknet.git",
"state": {
"branch": "master",
"revision": "1bec70f38856f1e8b9f814826d513942cc253460",
"revision": "af99b14bfae28c4ae88746cad894f9f059b4b653",
"version": null
}
},
Expand All @@ -60,7 +60,7 @@
"repositoryURL": "https://github.com/Extollite/swift-transferpe.git",
"state": {
"branch": "master",
"revision": "b872a1a298a20107a44ca2ce2453b35edf24ba45",
"revision": "109928246c49b8a83e34571a31f7a7bcf5d1016e",
"version": null
}
},
Expand Down
25 changes: 19 additions & 6 deletions Sources/TransferApp/main.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import Foundation
import TransferPe
import NIO
import RakNetSwift

let arguments: [String] = Array(CommandLine.arguments.dropFirst())

var ip = "mcpe.to"
var port = 19132
var group = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount)

defer {
do {
try group.syncShutdownGracefully()
} catch {
print(error)
}
}

if(arguments.count == 1){
ip = arguments[0]
Expand All @@ -13,14 +24,16 @@ if(arguments.count == 1){
port = Int(arguments[1])!
}

let server = TransferPe(ip, port)
let closeFuture = server.run()

let server = TransferPe(ip, port, false, withHandler: {
print("Server turned off!")
})

signal(SIGINT) { s in server.close() }

do {
try closeFuture!.wait()
} catch {
print(error)
server.run(group)

while(server.isRunning) {
//NOOP
}

0 comments on commit 7738df3

Please sign in to comment.