[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] eth-multiplexer: improve the demuxer function
From: |
Justus Winter |
Subject: |
[PATCH 8/8] eth-multiplexer: improve the demuxer function |
Date: |
Fri, 11 Apr 2014 23:09:58 +0200 |
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection "Handling Multiple Request
Types". This avoids initializing the reply message in every X_server
function. The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.
* eth-multiplexer/multiplexer.c (multiplexer_demuxer): Improve the
demuxer function. Prioritize the ethernet_demuxer.
---
eth-multiplexer/multiplexer.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
index a133f45..cc0024e 100644
--- a/eth-multiplexer/multiplexer.c
+++ b/eth-multiplexer/multiplexer.c
@@ -79,12 +79,17 @@ static int
multiplexer_demuxer (mach_msg_header_t *inp,
mach_msg_header_t *outp)
{
- int device_server (mach_msg_header_t *, mach_msg_header_t *);
- int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-
- return (device_server (inp, outp)
- || notify_server (inp, outp)
- || ethernet_demuxer (inp, outp));
+ mig_routine_t routine;
+ if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
+ (routine = device_server_routine (inp)) ||
+ (routine = notify_server_routine (inp)))
+ {
+ if (routine)
+ (*routine) (inp, outp);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
static void *
--
1.9.1
- [PATCH 2/8] devnode: fix argp_program_version, remove argp_program_bug_address, (continued)
- [PATCH 3/8] eth-filter: fix argp_program_version, remove argp_program_bug_address, Justus Winter, 2014/04/11
- Re: [PATCH 3/8] eth-filter: fix argp_program_version, remove argp_program_bug_address, Samuel Thibault, 2014/04/11
- [PATCH 4/8] eth-multiplexer: fix argp_program_version, remove argp_program_bug_address, Justus Winter, 2014/04/11
- Re: [PATCH 4/8] eth-multiplexer: fix argp_program_version, remove argp_program_bug_address, Samuel Thibault, 2014/04/11
- [PATCH 5/8] devnode: improve the demuxer function, Justus Winter, 2014/04/11
- Re: [PATCH 5/8] devnode: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 7/8] eth-filter: improve the demuxer function, Justus Winter, 2014/04/11
- Re: [PATCH 7/8] eth-filter: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 8/8] eth-multiplexer: improve the demuxer function,
Justus Winter <=
- Re: [PATCH 8/8] eth-multiplexer: improve the demuxer function, Samuel Thibault, 2014/04/11
- [PATCH 6/8] libmachdev: improve the demuxer functions, Justus Winter, 2014/04/11
- Re: [PATCH 6/8] libmachdev: improve the demuxer functions, Samuel Thibault, 2014/04/11
- Re: [PATCH 1/8] devnode: remove the ourdevice hack, Samuel Thibault, 2014/04/12
Re: [PATCH] include: fix the definition of device_open, Samuel Thibault, 2014/04/11
Re: [PATCH] include: fix the definition of device_open, Samuel Thibault, 2014/04/12