Skip to content

Commit

Permalink
Allow access to encapsulated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extollite committed Sep 18, 2020
1 parent 021dd2b commit 86f6eb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 0 additions & 4 deletions Sources/RakNetSwift/Listener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public class Listener {

var connectionListener : ConnectionListener?

public init () {

}

public func listen<T : ConnectionListener>(_ connectionListener : T?, _ serverInfo : ServerInfo, _ host : String = "0.0.0.0", _ port : Int = 19132) -> EventLoopFuture<Void>? {
let handler = ServerDatagramHandler()
handler.listener = self
Expand Down
5 changes: 3 additions & 2 deletions Sources/RakNetSwift/Protocol/Packets/AcknowledgePacket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ class AcknowledgePacket : Packet {
if(self.mtu >= 4) {
self.packets.append(Entry(start))
self.mtu -= 4
firstIndex = i
}
firstIndex = i

//self.packets.append(Entry(start))
} else if(start != end){
if(self.mtu >= 7){
self.packets.append(Entry(start, end))
self.mtu -= 7
firstIndex = i
}
firstIndex = i
//self.packets.append(Entry(start, end))
}
if(self.packets.count > 0){
Expand Down
6 changes: 3 additions & 3 deletions Sources/RakNetSwift/Protocol/Packets/EncapsulatedPacket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public class EncapsulatedPacket {
var splitCount : Int32 = 0
var splitId : Int32 = 0
var splitIndex : Int32 = 0
var buffer : ByteBuffer?
public var buffer : ByteBuffer?

var needACK = false
var ackId : Int32 = 0

func decode(_ buf : inout ByteBuffer) {
public func decode(_ buf : inout ByteBuffer) {
let flags = Int32(buf.readInteger(as: Int8.self)!)
reliability = Reliability.fromId((flags & 0b11100000) >> 5)
split = (flags & 0b00010000) != 0
Expand Down Expand Up @@ -54,7 +54,7 @@ public class EncapsulatedPacket {
buffer = buf.readSlice(length: Int(size))!
}

func encode(_ buf : inout ByteBuffer) {
public func encode(_ buf : inout ByteBuffer) {
var flags = reliability!.id << Int32(5)

if (split) {
Expand Down

0 comments on commit 86f6eb5

Please sign in to comment.