Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
imezx committed Apr 9, 2024
1 parent 739e135 commit 8fd9573
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 28 deletions.
40 changes: 30 additions & 10 deletions src/Index/Client/ClientProcess/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,37 @@ end

function ClientProcess.add(Identifier: any, originId: string)
if not clientQueue[Identifier] then
clientRatelimit[Identifier] = RateLimit.create(originId)
clientQueue[Identifier] = {}
unreliableClientQueue[Identifier] = {}
clientRequestQueue[Identifier] = {}
clientCallback[Identifier] = {}
if not clientRatelimit[Identifier] then
clientRatelimit[Identifier] = RateLimit.create(originId)
end
if not clientQueue[Identifier] then
clientQueue[Identifier] = {}
end
if not unreliableClientQueue[Identifier] then
unreliableClientQueue[Identifier] = {}
end
if not clientRequestQueue[Identifier] then
clientRequestQueue[Identifier] = {}
end
if not clientCallback[Identifier] then
clientCallback[Identifier] = {}
end

queueOutRequest[1][Identifier] = {}
queueOutRequest[2][Identifier] = {}
queueInRequest[1][Identifier] = {}
queueInRequest[2][Identifier] = {}
queueIn[Identifier] = {}
if not queueOutRequest[1][Identifier] then
queueOutRequest[1][Identifier] = {}
end
if not queueOutRequest[2][Identifier] then
queueOutRequest[2][Identifier] = {}
end
if not queueInRequest[1][Identifier] then
queueInRequest[1][Identifier] = {}
end
if not queueInRequest[2][Identifier] then
queueInRequest[2][Identifier] = {}
end
if not queueIn[Identifier] then
queueIn[Identifier] = {}
end
end
end

Expand Down
36 changes: 27 additions & 9 deletions src/Index/Server/ServerProcess/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,34 @@ end
function ServerProcess.add(Identifier: string, originId: string, ratelimit: Type.rateLimitArg)
if not serverQueue[Identifier] then
RateLimit.create(originId, ratelimit.maxEntrance or 200, ratelimit.interval or 2)
serverQueue[Identifier] = {}
unreliableServerQueue[Identifier] = {}
serverCallback[Identifier] = {}
serverRequestQueue[Identifier] = {}
if not serverQueue[Identifier] then
serverQueue[Identifier] = {}
end
if not unreliableServerQueue[Identifier] then
unreliableServerQueue[Identifier] = {}
end
if not serverCallback[Identifier] then
serverCallback[Identifier] = {}
end
if not serverRequestQueue[Identifier] then
serverRequestQueue[Identifier] = {}
end

queueIn[Identifier] = {}
queueInRequest[1][Identifier] = {}
queueInRequest[2][Identifier] = {}
queueOutRequest[1][Identifier] = {}
queueOutRequest[2][Identifier] = {}
if not queueIn[Identifier] then
queueIn[Identifier] = {}
end
if not queueInRequest[1][Identifier] then
queueInRequest[1][Identifier] = {}
end
if not queueInRequest[2][Identifier] then
queueInRequest[2][Identifier] = {}
end
if not queueOutRequest[1][Identifier] then
queueOutRequest[1][Identifier] = {}
end
if not queueOutRequest[2][Identifier] then
queueOutRequest[2][Identifier] = {}
end

for _, player: Player in ipairs(Players:GetPlayers()) do
task.spawn(initializeEachPlayer, player)
Expand Down
18 changes: 9 additions & 9 deletions src/Index/Util/Buffer/Dedicated.luau
Original file line number Diff line number Diff line change
Expand Up @@ -59,55 +59,55 @@ end

function DedicatedBuffer.wi8(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(1)
self:alloc(1)
writei8(self.buffer, self.point, val)
end

function DedicatedBuffer.wi16(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(2)
self:alloc(2)
writei16(self.buffer, self.point, val)
end

function DedicatedBuffer.wi32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writei32(self.buffer, self.point, val)
end

function DedicatedBuffer.wu8(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(1)
self:alloc(1)
writeu8(self.buffer, self.point, val)
end

function DedicatedBuffer.wu16(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(2)
self:alloc(2)
writeu16(self.buffer, self.point, val)
end

function DedicatedBuffer.wu32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writeu32(self.buffer, self.point, val)
end

function DedicatedBuffer.wf32(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(4)
self:alloc(4)
writef32(self.buffer, self.point, val)
end

function DedicatedBuffer.wf64(self: any, val: number)
if not val then return end
DedicatedBuffer:alloc(8)
self:alloc(8)
writef64(self.buffer, self.point, val)
end

function DedicatedBuffer.wstring(self: any, val: string)
if not val then return end
DedicatedBuffer:alloc(#val)
self:alloc(#val)
writestring(self.buffer, self.point, val)
end

Expand Down

0 comments on commit 8fd9573

Please sign in to comment.