net: Context accept cb needs to return failure code
If the connection establishment has an error, the accept callback needs to be able to return that error to user space so that the application can know about it. This is especially important in TCP where application needs to start to listen again if reset is sent during connection establishment. Change-Id: I55f36e4f101c7237c1288f09baf6e602b33da2b3 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
73aa1cc72c
commit
c427e9bbd6
2 changed files with 6 additions and 2 deletions
|
@ -470,17 +470,20 @@ int net_context_connect(struct net_context *context,
|
|||
* @brief Accept callback
|
||||
*
|
||||
* @details The accept callback is called after a successful
|
||||
* connection is being established while we are waiting a connection
|
||||
* attempt. The callback is called in fiber context.
|
||||
* connection is being established or if there was an error
|
||||
* while we were waiting for a connection attempt.
|
||||
* The callback is called in fiber context.
|
||||
*
|
||||
* @param context The context to use.
|
||||
* @param addr The peer address.
|
||||
* @param addrlen Length of the peer address.
|
||||
* @param status The status code, 0 on success, < 0 otherwise
|
||||
* @param user_data The user data given in net_context_accept() call.
|
||||
*/
|
||||
typedef void (*net_context_accept_cb_t)(struct net_context *new_context,
|
||||
struct sockaddr *addr,
|
||||
socklen_t addrlen,
|
||||
int status,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
|
|
@ -437,6 +437,7 @@ static bool net_ctx_connect_v4(void)
|
|||
static void accept_cb(struct net_context *context,
|
||||
struct sockaddr *addr,
|
||||
socklen_t addrlen,
|
||||
int status,
|
||||
void *user_data)
|
||||
{
|
||||
sa_family_t family = POINTER_TO_INT(user_data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue