Skip to content

Commit

Permalink
refactor: function name
Browse files Browse the repository at this point in the history
  • Loading branch information
sectasy0 committed Oct 31, 2024
1 parent be62f5e commit e403385
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/network/listener.zig
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fn handle_incoming(self: *Listener, worker: *Worker) AcceptResult {

fn handle_connection(self: *const Listener, worker: *Worker, connection: *Connection) void {
while (true) {
self.handle_request(worker, connection) catch |err| {
self.on_receive(worker, connection) catch |err| {
switch (err) {
error.WouldBlock => return,
error.NotOpenForReading => return,
Expand Down Expand Up @@ -246,7 +246,7 @@ fn handle_disconnection(self: *Listener, worker: *Worker, connection: *Connectio
}
}

fn handle_request(self: *const Listener, worker: *Worker, connection: *Connection) !void {
fn on_receive(self: *const Listener, worker: *Worker, connection: *Connection) !void {
const read_size = try connection.stream.read(connection.buffer[connection.position..]);

if (read_size == 0) return error.ConnectionClosed;
Expand Down Expand Up @@ -276,6 +276,8 @@ fn handle_request(self: *const Listener, worker: *Worker, connection: *Connectio
return;
};

// here we've got the completed message

connection.position = 0;

var processor = requests.Processor.init(
Expand Down

0 comments on commit e403385

Please sign in to comment.