]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept()
authorWilly Tarreau <w@1wt.eu>
Thu, 14 Apr 2016 09:13:20 +0000 (11:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 14 Apr 2016 09:18:22 +0000 (11:18 +0200)
commit7a798e5d6b2f7134db34028f5052a9865ca9d946
tree02298fbc1881d67eb31e325ed69f9ab7c4f916c6
parenteba5634f2c6d0eced75aacd28a5ae5e5d0613911
CLEANUP: fix inconsistency between fd->iocb, proto->accept and accept()

There's quite some inconsistency in the internal API. listener_accept()
which is the main accept() function returns void but is declared as int
in the include file. It's assigned to proto->accept() for all stream
protocols where an int is expected but the result is never checked (nor
is it documented by the way). This proto->accept() is in turn assigned
to fd->iocb() which is supposed to return an int composed of FD_WAIT_*
flags, but which is never checked either.

So let's fix all this mess :
  - nobody checks accept()'s return
  - nobody checks iocb()'s return
  - nobody sets a return value

=> let's mark all these functions void and keep the current ones intact.

Additionally we now include listener.h from listener.c to ensure we won't
silently hide this incoherency in the future.

Note that this patch could/should be backported to 1.6 and even 1.5 to
simplify debugging sessions.
include/proto/connection.h
include/proto/listener.h
include/proto/proto_udp.h
include/types/fd.h
include/types/protocol.h
src/connection.c
src/listener.c
src/proto_udp.c