lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Removing the restriction on number of sockets


From: Joel Cunningham
Subject: Re: [lwip-devel] Removing the restriction on number of sockets
Date: Mon, 07 Aug 2017 17:25:53 -0500

> On Aug 7, 2017, at 4:19 PM, Joan Lledó <address@hidden> wrote:
> 
> 2017-08-07 22:16 GMT+02:00 address@hidden <address@hidden>:
>> The proposal doesn't look too bad overall. However, I'm not sure using a
>> linked list is the best solution. If you implement this to not have the
>> total number of sockets limited, a linked list might hurt...
>> 
> 
> Yeah, I don't like it neither, but I need a way to find a lwip_sock
> from a socket number, and iterating a linked list was the first idea
> that came to my mind. Any suggestion?


> 
>> An I wouldn't limit the "open socket count" functionality to
>> MEM_LIBC_MALLOC. We do have a heap which can be used for this.
>> 
> 
> Wouldn't that limit the amount of sockets due to MEM_SIZE?

I think Simon meant that systems with MEM_LIBC_MALLOC = 0 could also use 
dynamic sockets because mem_malloc() comes from LwIP’s internal heap in that 
case.

It may be worth noting that there aren’t existing example of “static” versus 
“dynamic” implementations of data structures within LwIP.  I would think we’d 
want a solution that could work for all systems so two don’t have to be 
maintained.

Maybe a memory pool for sockets would allow a dynamic/unrestricted size when 
used with MEMP_MEM_MALLOC = 1 (as Simon suggested) and MEM_LIBC_MALLOC = 1, but 
a fixed size for systems with MEMP_MEM_MALLOC = 0.  Since memory pools 
typically allocate one at a time, we’d need to figure out how to link the 
allocations together that allows fast lookup or maybe use some type of slab 
allocation...I’ll brainstorm this some more

Joel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]