#548: Error handling in socket system
-------------------------+--------------------------------------------------
Reporter: whiteknight | Owner:
Type: RFC | Status: new
Priority: normal | Milestone:
Component: core | Version:
Severity: medium | Keywords: socket
Lang: | Patch:
Platform: all |
-------------------------+--------------------------------------------------
Comment(by Infinoid):
Some of the issues you've raised are not specific to sockets, but affect
the whole I/O subsystem.
That #ifdef/#endif chain isn't checking whether a function succeeded per
se, it's checking whether the os_handle is still at its default value.
See a similar ifdef/endif chain in Filehandle.init(), where those default
values were assigned.
It seems to me there are some elements of the sockets API which don't need
to be socket-specific at all. In this case, Parrot_io_socket_is_closed
could just call PIO_IS_CLOSED. But if you look at how the latter is
implemented, it calls one of [Parrot_io_is_closed_unix,
Parrot_io_is_closed_win32, Parrot_io_is_closed_portable], each of which
has one if() statement. This is equally as bad as the ifdef/endif chain
in my opinion, and even more spread out. Do you have any suggestions on
what the "right" way to do this is?
How about a #define indicating what an invalid handle is for the current
platform (called "PARROT_INVALID_HANDLE_VALUE" perhaps), and a simple
equality test against that?
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/548#comment:1>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets