aboutsummaryrefslogtreecommitdiff
path: root/src/core/socket.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-28 22:55:17 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-28 22:55:17 -0800
commit790e4de4453b0f016974aed1cc89a3ac47ba60c2 (patch)
treedfe2dce347f6e354b734025244181a626b489171 /src/core/socket.h
parente8c4e9ebe5d8c2565c79bb906e8298013988ceb0 (diff)
downloadnng-790e4de4453b0f016974aed1cc89a3ac47ba60c2.tar.gz
nng-790e4de4453b0f016974aed1cc89a3ac47ba60c2.tar.bz2
nng-790e4de4453b0f016974aed1cc89a3ac47ba60c2.zip
Pipe ID calculations & socket error functions.
The use of platform_next_id was a bit off, because it could give back pipe IDs that were too large (the high order bit must be clear), and in very long running applications serving many connections, the IDs could wrap and lead to duplicates. Also we have added functions to set the recverr or senderr values, which can be used by protocols -- either during initialization, or during filters. (REQ uses this for example.)
Diffstat (limited to 'src/core/socket.h')
-rw-r--r--src/core/socket.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/socket.h b/src/core/socket.h
index 35ddc36c..c80af22e 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -61,4 +61,10 @@ extern int nni_getopt_duration(nni_duration *, void *, size_t *);
extern int nni_setopt_int(int *, const void *, size_t);
extern int nni_getopt_int(int *, void *, size_t *);
+// Set error codes for applications. These are only ever
+// called from the filter functions in protocols, and thus
+// already have the socket lock held.
+extern void nni_socket_recverr(nni_socket *, int);
+extern void nni_socket_senderr(nni_socket *, int);
+
#endif // CORE_SOCKET_H