mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2580 from geky/nsapi-bind-again
lwip - Add check for previously-bound socketpull/2593/head
commit
fb7ffcb5a3
|
|
@ -278,6 +278,11 @@ static int lwip_socket_bind(nsapi_stack_t *stack, nsapi_socket_t handle, nsapi_a
|
|||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
if ((s->conn->type == NETCONN_TCP && s->conn->pcb.tcp->local_port != 0) ||
|
||||
(s->conn->type == NETCONN_UDP && s->conn->pcb.udp->local_port != 0)) {
|
||||
return NSAPI_ERROR_PARAMETER;
|
||||
}
|
||||
|
||||
err_t err = netconn_bind(s->conn, (ip_addr_t *)addr.bytes, port);
|
||||
return lwip_err_remap(err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue