net: context: Add status to connect callback
It is useful that the user API can know whether the connection was established properly or not. So this commit adds status parameter to connect callback in net_context API. The call to connect callback needs to be set properly in TCP code. This commit does not fix the connect callback call which is not properly done right now in net_context.c. Change-Id: I284a60ddd658ceef9e65022e96591f467a936a09 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
724aa3ffbd
commit
088289ec28
3 changed files with 8 additions and 3 deletions
|
@ -446,9 +446,13 @@ int net_context_listen(struct net_context *context,
|
|||
* established.
|
||||
*
|
||||
* @param context The context to use.
|
||||
* @param status Status of the connection establishment. This is 0
|
||||
* if the connection was established successfully, <0 if there was an
|
||||
* error.
|
||||
* @param user_data The user data given in net_context_connect() call.
|
||||
*/
|
||||
typedef void (*net_context_connect_cb_t)(struct net_context *context,
|
||||
int status,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1081,7 +1081,7 @@ int net_context_connect(struct net_context *context,
|
|||
#if defined(CONFIG_NET_UDP)
|
||||
if (net_context_get_type(context) == SOCK_DGRAM) {
|
||||
if (cb) {
|
||||
cb(context, user_data);
|
||||
cb(context, 0, user_data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1112,7 +1112,7 @@ int net_context_connect(struct net_context *context,
|
|||
send_syn(context, addr);
|
||||
|
||||
if (cb) {
|
||||
cb(context, user_data);
|
||||
cb(context, 0, user_data);
|
||||
}
|
||||
|
||||
/* in tcp_synack_received() we give back this semaphore */
|
||||
|
|
|
@ -349,7 +349,8 @@ static bool net_ctx_listen_v4(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void connect_cb(struct net_context *context, void *user_data)
|
||||
static void connect_cb(struct net_context *context, 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