mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-13 19:57:05 +08:00
sockets: change closing: netconn is freed when socket is closed, not before
This is necessary to implement fullduplex sockets that are closed asynchronously: the netconn in the socket must not be freed before all threads have given up using it. We now call the first part of 'netconn_delete()' (moved to 'netconn_prepare_delete()') from lwip_close() and only actually end up calling 'netconn_free()' from 'free_socket()', which might be called later if LWIP_NETCONN_FULLDUPLEX is enabled. Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
@@ -73,6 +73,10 @@ extern "C" {
|
||||
#define NETCONN_FLAG_NON_BLOCKING 0x02
|
||||
/** Was the last connect action a non-blocking one? */
|
||||
#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04
|
||||
#if LWIP_NETCONN_FULLDUPLEX
|
||||
/** The mbox of this netconn is being deallocated, don't use it anymore */
|
||||
#define NETCONN_FLAG_MBOXINVALID 0x08
|
||||
#endif /* LWIP_NETCONN_FULLDUPLEX */
|
||||
/** If a nonblocking write has been rejected before, poll_tcp needs to
|
||||
check if the netconn is writable again */
|
||||
#define NETCONN_FLAG_CHECK_WRITESPACE 0x10
|
||||
@@ -302,6 +306,7 @@ struct netvector {
|
||||
#define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c)
|
||||
struct netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
|
||||
netconn_callback callback);
|
||||
err_t netconn_prepare_delete(struct netconn *conn);
|
||||
err_t netconn_delete(struct netconn *conn);
|
||||
/** Get the type of a netconn (as enum netconn_type). */
|
||||
#define netconn_type(conn) (conn->type)
|
||||
|
||||
Reference in New Issue
Block a user