mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-16 21:26:43 +08:00
netconn: add callback arg storage
This reuses the member 'int socket' by making it a union containing both int and void pointer. See bug #56593. Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de> Suggested-by: Wilfred <wilfrednilsen@hotmail.com>
This commit is contained in:
@@ -246,10 +246,10 @@ struct netconn {
|
||||
all threads when closing while threads are waiting. */
|
||||
int mbox_threads_waiting;
|
||||
#endif
|
||||
/** only used for socket layer */
|
||||
#if LWIP_SOCKET
|
||||
int socket;
|
||||
#endif /* LWIP_SOCKET */
|
||||
union {
|
||||
int socket;
|
||||
void *ptr;
|
||||
} callback_arg;
|
||||
#if LWIP_SO_SNDTIMEO
|
||||
/** timeout to wait for sending data (which means enqueueing data for sending
|
||||
in internal buffers) in milliseconds */
|
||||
@@ -373,6 +373,9 @@ err_t netconn_err(struct netconn *conn);
|
||||
#define netconn_clear_flags(conn, clr_flags) do { (conn)->flags = (u8_t)((conn)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
|
||||
#define netconn_is_flag_set(conn, flag) (((conn)->flags & (flag)) != 0)
|
||||
|
||||
#define netconn_set_callback_arg(conn, arg) do { (conn)->callback_arg.ptr = (arg); } while(0)
|
||||
#define netconn_get_callback_arg(conn) ((conn)->callback_arg.ptr)
|
||||
|
||||
/** Set the blocking status of netconn calls (@todo: write/send is missing) */
|
||||
#define netconn_set_nonblocking(conn, val) do { if(val) { \
|
||||
netconn_set_flags(conn, NETCONN_FLAG_NON_BLOCKING); \
|
||||
|
||||
Reference in New Issue
Block a user