hitstergtd / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

example programs test PGM_IO_STATUS_ERROR with no effect #38

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Look inside
async.c
blocksyncrecv.c
daytime.c
enonblocksyncrecv.c
enonblocksyncrecvmsg.c
enonblocksyncrecvmsgv.c
pgmrecv.c
pnonblocksyncrecv.c
purinrecv.c
snonblocksyncrecv.c

At the bottom of a switch block,
    if (PGM_IO_STATUS_ERROR == status)
        break;

What is the expected output? What do you see instead?

Since this is the bottom of a switch block, it was going to "break" anyway.  
The current code has no effect and the compiler's optimized could remove this 
dead code.

I am new to this library.  It is difficult to understand what was really 
intended.  My best guess is the break was intended for the loop.

What version of the product are you using? On what operating system?

I am using the source copied via SVN.  Target platforms are linux and Mac OSX.

Please provide any additional information below.

I have been looking at the documentation.  It isn't clear which kinds of errors 
are recoverable.  Some mention was made of PGM_IO_STATUS_RESET.

Looking at the code, PGM_IO_STATUS_ERROR seems to be really bad.  Invalid 
parameters or invalid state.  Highly suggestive of a programming error.

Original issue reported on code.google.com by tdpr...@teleosmedia.com on 11 Aug 2015 at 2:27

GoogleCodeExporter commented 8 years ago
The semantics of the PGM_IO* error set follow the design of the GLib IO 
Channels ( 
https://developer.gnome.org/glib/2.26/glib-IO-Channels.html#GIOStatus ).

It does look rather odd, I think the broken intention is to terminate the while 
loop and thus why the demos hang when an error has occurred instead of exiting.

Original comment by fnjo...@gmail.com on 13 Aug 2015 at 10:52