Skip to content

Commit 5fd0f1c

Browse files
committed
fixes
1 parent f0c2c46 commit 5fd0f1c

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sanctumterra/raknet",
3-
"version": "1.3.71",
3+
"version": "1.3.72",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {

src/client/client.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ export class Client extends Emitter<ClientEvents> {
164164

165165
public frameAndSend(payload: Buffer, priority: Priority): void {
166166
const frame = new Frame();
167-
frame.reliability = Reliability.ReliableOrdered;
168167
frame.payload = payload;
169168
frame.orderChannel = 0;
170169
this.sendFrame(frame, priority);
@@ -179,7 +178,6 @@ export class Client extends Emitter<ClientEvents> {
179178
Logger.debug(
180179
`[Client] Sending packet ${buffer[0]}, ${buffer.length} bytes to ${this.options.address}:${this.options.port}`,
181180
);
182-
Logger.debug(`[Client] Current connection status: ${Status[this.status]}`);
183181

184182
try {
185183
this.socket.send(
@@ -191,7 +189,7 @@ export class Client extends Emitter<ClientEvents> {
191189
);
192190
} catch (error) {
193191
Logger.error("[Client] Failed to send packet", error as Error);
194-
this.cleanup();
192+
// this.cleanup();
195193
}
196194
}
197195

src/client/framer.ts

+1-22
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ export class Framer {
4949
private outputFramesByteLength = 0;
5050
public outputBackup = new Map<number, Frame[]>();
5151
public _tickCount = 0;
52-
private lastPingSent = 0;
53-
private lastPongReceived = 0;
5452

5553
constructor(client: Client) {
5654
this.client = client;
5755
this.outputFrameQueue = new Frameset();
5856
this.outputFrameQueue.frames = [];
5957
this.outputOrderIndex = Array.from<number>({ length: 32 }).fill(0);
6058
this.outputSequenceIndex = Array.from<number>({ length: 32 }).fill(0);
61-
this.lastPongReceived = Date.now();
6259
}
6360

6461
public tick() {
@@ -73,27 +70,11 @@ export class Framer {
7370
return;
7471
}
7572

76-
const now = Date.now();
77-
78-
if (
79-
now - this.lastPongReceived > 30000 &&
80-
this.client.status === Status.Connected
81-
) {
82-
Logger.warn(
83-
"[Framer] No pong received in last 30 seconds, disconnecting",
84-
);
85-
this.client.cleanup();
86-
return;
87-
}
88-
8973
if (this._tickCount % 50 === 0) {
90-
this.lastPingSent = now;
74+
const now = Date.now();
9175
const ping = new ConnectedPing();
9276
ping.timestamp = BigInt(now);
9377
this.frameAndSend(ping.serialize(), Priority.Immediate);
94-
Logger.debug(
95-
`[Framer] Sent ping at ${now}, last pong received: ${this.lastPongReceived}`,
96-
);
9778
}
9879

9980
const ackSeqs = this.receivedFrameSequences;
@@ -248,7 +229,6 @@ export class Framer {
248229
}
249230
case Packet.ConnectedPong: {
250231
const packet = new ConnectedPong(frame.payload).deserialize();
251-
this.lastPongReceived = Date.now();
252232
Logger.debug(
253233
`[Framer] Received pong, latency: ${
254234
Date.now() - Number(packet.pingTime)
@@ -453,7 +433,6 @@ export class Framer {
453433
priority: Priority = Priority.Normal,
454434
): void {
455435
const frame = new Frame();
456-
frame.reliability = Reliability.ReliableOrdered;
457436
frame.orderChannel = 0;
458437
frame.payload = payload;
459438
this.sendFrame(frame, priority);

0 commit comments

Comments
 (0)