[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-devel] [bug #20021] conn->sem is only signaled one-way
From: |
Goldschmidt Simon |
Subject: |
RE: [lwip-devel] [bug #20021] conn->sem is only signaled one-way |
Date: |
Wed, 4 Jul 2007 11:34:43 +0200 |
OK for me!
> Follow-up Comment #22, bug #20021 (project lwip):
>
> About socket layer: so, netconn_close is not called, we stay on a
> netconn_delete: ok, since this call do the job (and a smart
> linker will remove netconn_close/do_close from the code).
>
> I see a little problem: netconn_delete is called inside the
> sys_sem_wait(socksem)/sys_sem_signal(socksem).
>
> I think it could be a problem because any new socket can't be
> created during the close. Comments in lwip_close say it's
> done because "/* We cannot allow multiple closes of the same
> socket. */". Since others API file like lwip_send can call by
> another thread in the same time, I think this protection is
> not enough, and give more problem.
>
> I propose to change the code like this :
>
> int
> lwip_close(int s)
> {
> struct lwip_socket *sock;
>
> LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)n", s));
>
> sock = get_socket(s);
> if (!sock) {
> return -1;
> }
>
> netconn_delete(sock->conn);
>
> sys_sem_wait(socksem);
> if (sock->lastdata) {
> netbuf_delete(sock->lastdata);
> }
> sock->lastdata = NULL;
> sock->lastoffset = 0;
> sock->conn = NULL;
> sock_set_errno(sock, 0);
> sys_sem_signal(socksem);
> return 0;
> }
>
> Comments?
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/03
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/03
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/04
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/04
- RE: [lwip-devel] [bug #20021] conn->sem is only signaled one-way,
Goldschmidt Simon <=
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Kieran Mansley, 2007/07/13
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/13
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/13
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/16
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/24
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/24
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/25
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Simon Goldschmidt, 2007/07/25
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Kieran Mansley, 2007/07/26
- [lwip-devel] [bug #20021] conn->sem is only signaled one-way, Frédéric Bernon, 2007/07/26