mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-20 16:24:50 +00:00
GREATLY improve clarity
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
const is_debug = builtin.mode == .Debug;
|
const is_debug = builtin.mode == .Debug;
|
||||||
const base64Enc = std.base64.Base64Encoder.init(std.base64.standard_alphabet_chars, '=');
|
const base64Enc = std.base64.Base64Encoder.init(std.base64.standard_alphabet_chars, '=');
|
||||||
const base64Dec = std.base64.Base64Decoder.init(std.base64.standard_alphabet_chars, '=');
|
const base64Dec = std.base64.Base64Decoder.init(std.base64.standard_alphabet_chars, '=');
|
||||||
|
|
||||||
|
/// This creates a debug allocator that can only be referenced in debug mode.
|
||||||
|
/// You should check for is_debug around every reference to dba.
|
||||||
var dba: DebugAllocator =
|
var dba: DebugAllocator =
|
||||||
if (is_debug)
|
if (is_debug)
|
||||||
DebugAllocator.init
|
DebugAllocator.init
|
||||||
@@ -143,7 +146,9 @@ const SaprusMessage = union(SaprusPacketType) {
|
|||||||
var s = std.io.fixedBufferStream(bytes);
|
var s = std.io.fixedBufferStream(bytes);
|
||||||
const r = s.reader();
|
const r = s.reader();
|
||||||
|
|
||||||
switch (@as(SaprusPacketType, @enumFromInt(try r.readInt(u16, .big)))) {
|
const packet_type = @as(SaprusPacketType, @enumFromInt(try r.readInt(u16, .big)));
|
||||||
|
|
||||||
|
switch (packet_type) {
|
||||||
.relay => return fromBytesAux(.relay, Relay.Header, r, allocator),
|
.relay => return fromBytesAux(.relay, Relay.Header, r, allocator),
|
||||||
.connection => return fromBytesAux(.connection, Connection.Header, r, allocator),
|
.connection => return fromBytesAux(.connection, Connection.Header, r, allocator),
|
||||||
.file_transfer => return SaprusError.NotImplementedSaprusType,
|
.file_transfer => return SaprusError.NotImplementedSaprusType,
|
||||||
|
|||||||
Reference in New Issue
Block a user