Naming consistency fixed (MESSAGE_TX and MESSAGE_RX).

master
Philippe Pittoli 2023-01-20 23:12:04 +01:00
parent da27ce33dd
commit 3e3d996e7b
7 changed files with 23 additions and 23 deletions

View File

@ -107,7 +107,7 @@ fn create_service() !void {
break;
},
.MESSAGE => {
.MESSAGE_RX => {
print("Client asking for a service through ipcd.\n", .{});
defer ctx.close_fd (some_event.origin) catch {};
if (some_event.m) |m| {
@ -206,7 +206,7 @@ fn create_service() !void {
}
},
.TX => {
.MESSAGE_TX => {
print("Message sent.\n", .{});
},

View File

@ -43,7 +43,7 @@ pub fn main() !u8 {
print("Timer!\n", .{});
},
.MESSAGE => {
.MESSAGE_RX => {
if (some_event.m) |m| {
print("message has been bounced: {}\n", .{m});
m.deinit();
@ -55,7 +55,7 @@ pub fn main() !u8 {
}
},
.TX => {
.MESSAGE_TX => {
print("Message sent.\n", .{});
},

View File

@ -79,7 +79,7 @@ fn create_service() !void {
, .{some_event.origin, ctx.pollfd.items.len});
},
.MESSAGE => {
.MESSAGE_RX => {
if (some_event.m) |m| {
print("New message ({} bytes)\n", .{m.payload.len});
util.print_message ("RECEIVED MESSAGE", m);
@ -92,7 +92,7 @@ fn create_service() !void {
}
},
.TX => {
.MESSAGE_TX => {
print("Message sent.\n", .{});
},

View File

@ -185,7 +185,7 @@ fn create_service() !void {
print ("Message has been sent (SWITCH fd {}).\n", .{some_event.origin});
},
.MESSAGE => {
.MESSAGE_RX => {
print ("Client asking for a service through TCPd.\n", .{});
errdefer ctx.close (some_event.index) catch {};
if (some_event.m) |m| {
@ -240,7 +240,7 @@ fn create_service() !void {
}
},
.TX => {
.MESSAGE_TX => {
print ("Message sent.\n", .{});
},

View File

@ -5,14 +5,14 @@
enum event_types {
ERROR = 0 // A problem occured.
, EXTERNAL = 1 // Message received from a non IPC socket.
, SWITCH_RX = 2 // Message received from a switched FD.
, SWITCH_TX = 3 // Message sent to a switched fd.
, CONNECTION = 4 // New user.
, DISCONNECTION = 5 // User disconnected.
, MESSAGE = 6 // New message.
, TIMER = 7 // Timeout in the poll(2) function.
, TX = 8 // Message sent.
, CONNECTION = 1 // New user.
, DISCONNECTION = 2 // User disconnected.
, MESSAGE_RX = 3 // New message.
, MESSAGE_TX = 4 // Message sent.
, TIMER = 5 // Timeout in the poll(2) function.
, EXTERNAL = 6 // Message received from a non IPC socket.
, SWITCH_RX = 7 // Message received from a switched FD.
, SWITCH_TX = 8 // Message sent to a switched fd.
};
// Return type of callback functions when switching.

View File

@ -439,7 +439,7 @@ pub const Context = struct {
};
if (maybe_message) |m| {
return Event.init(Event.Type.MESSAGE, i, fd.fd, m);
return Event.init(Event.Type.MESSAGE_RX, i, fd.fd, m);
}
try self.close(i);
@ -486,7 +486,7 @@ pub const Context = struct {
// otherwise = write message for the msg.fd
try self.write (m);
m.deinit();
return Event.init(Event.Type.TX, i, fd.fd, null);
return Event.init(Event.Type.MESSAGE_TX, i, fd.fd, null);
}
}
// .revent is POLLHUP

View File

@ -35,14 +35,14 @@ pub const Event = struct {
pub const Type = enum {
ERROR, // A problem occured.
CONNECTION, // New user.
DISCONNECTION, // User disconnected.
MESSAGE_RX, // New message.
MESSAGE_TX, // Message sent.
TIMER, // Timeout in the poll(2) function.
EXTERNAL, // Message received from a non IPC socket.
SWITCH_RX, // Message received from a switched FD.
SWITCH_TX, // Message sent to a switched fd.
CONNECTION, // New user.
DISCONNECTION, // User disconnected.
MESSAGE, // New message.
TIMER, // Timeout in the poll(2) function.
TX, // Message sent.
};
t: Event.Type,