diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-01-11 13:15:40 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-01-11 14:15:37 -0800 |
| commit | 6d92c73e5cdf93fe70b0646e78a250e01a8d2f65 (patch) | |
| tree | cb14648b92b02e17bcb48f41a623009cdd65e0ab /src/core/message.h | |
| parent | 516b99946aad5da15020de9d7175d44c12fd14c6 (diff) | |
| download | nng-6d92c73e5cdf93fe70b0646e78a250e01a8d2f65.tar.gz nng-6d92c73e5cdf93fe70b0646e78a250e01a8d2f65.tar.bz2 nng-6d92c73e5cdf93fe70b0646e78a250e01a8d2f65.zip | |
XREQ and others race on TTL.
The TTL in these cases should have been atomic. To facilitate
things we actually introduce an atomic int for convenience. We
also introduce a convenience nni_msg_must_append_u32() and
nni_msg_header_must_append_u32(), so that we can eliminate some
failure tests that cannot ever happen. Combined with a new test
for xreq, we have 100% coverage for xreq and more coverage for
the other REQ/REP protocols.
Diffstat (limited to 'src/core/message.h')
| -rw-r--r-- | src/core/message.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/message.h b/src/core/message.h index 5ec1d9a1..c96bae99 100644 --- a/src/core/message.h +++ b/src/core/message.h @@ -62,4 +62,11 @@ extern uint64_t nni_msg_header_chop_u64(nni_msg *); extern void nni_msg_set_pipe(nni_msg *, uint32_t); extern uint32_t nni_msg_get_pipe(const nni_msg *); +// These should only be used when the transport or protocol is absolutely +// certain that there is adequate room. There is about 32 bytes of +// header and trailer space for a newly allocated message, and transports +// should generally not be burning more than half that. +extern void nni_msg_must_append_u32(nni_msg *, uint32_t); +extern void nni_msg_header_must_append_u32(nni_msg *, uint32_t); + #endif // CORE_SOCKET_H |
