net: context: Connect callback was set too late
We need to set the connect_cb for the context before sending SYN packet. This is required if we have a loopback connection in which case everything is happening more or less synchronously and the connect_cb would not be called in this case because its value would still be null. For remote network connections this patch makes no difference. Change-Id: Id7f837cd9e81cd79c4666c98cae84f6cb1a77af0 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
da6eba463d
commit
d8dd91d7bf
1 changed files with 3 additions and 2 deletions
|
@ -1153,12 +1153,13 @@ int net_context_connect(struct net_context *context,
|
|||
return ret;
|
||||
}
|
||||
|
||||
context->connect_cb = cb;
|
||||
context->user_data = user_data;
|
||||
|
||||
net_context_set_state(context, NET_CONTEXT_CONNECTING);
|
||||
|
||||
send_syn(context, addr);
|
||||
|
||||
context->connect_cb = cb;
|
||||
context->user_data = user_data;
|
||||
|
||||
/* in tcp_synack_received() we give back this semaphore */
|
||||
if (timeout != 0 && k_sem_take(&context->tcp->connect_wait, timeout)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue