mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-21 16:54:49 +00:00
Attempt to base64 encode the connection payload
For some reason I am still getting this: 2025/05/10 16:37:06 Error decoding message: SGVsbG8gZGFya25lc3MgbXkgb2xkIGZyaWVuZA==::53475673624738675a4746796132356c63334d6762586b676232786b49475a79615756755a413d3daaaa
This commit is contained in:
@@ -80,7 +80,10 @@ pub fn sendInitialConnection(payload: []const u8, initial_port: u16, allocator:
|
|||||||
const msg_bytes = try allocator.alignedAlloc(
|
const msg_bytes = try allocator.alignedAlloc(
|
||||||
u8,
|
u8,
|
||||||
@alignOf(SaprusMessage),
|
@alignOf(SaprusMessage),
|
||||||
try SaprusMessage.lengthForPayloadLength(.connection, payload.len),
|
try SaprusMessage.lengthForPayloadLength(
|
||||||
|
.connection,
|
||||||
|
base64Enc.calcSize(payload.len),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
defer allocator.free(msg_bytes);
|
defer allocator.free(msg_bytes);
|
||||||
const msg: *SaprusMessage = .init(.connection, msg_bytes);
|
const msg: *SaprusMessage = .init(.connection, msg_bytes);
|
||||||
@@ -88,7 +91,7 @@ pub fn sendInitialConnection(payload: []const u8, initial_port: u16, allocator:
|
|||||||
const connection = (try msg.getSaprusTypePayload()).connection;
|
const connection = (try msg.getSaprusTypePayload()).connection;
|
||||||
connection.src_port = initial_port;
|
connection.src_port = initial_port;
|
||||||
connection.dest_port = dest_port;
|
connection.dest_port = dest_port;
|
||||||
@memcpy(connection.getPayload(), payload);
|
_ = base64Enc.encode(connection.getPayload(), payload);
|
||||||
|
|
||||||
try broadcastSaprusMessage(msg, 8888);
|
try broadcastSaprusMessage(msg, 8888);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user