ARMmbed / sockets

mbed sockets library abstraction layer
Other
6 stars 18 forks source link

Pausing accept processing #50

Closed lws-team closed 8 years ago

lws-team commented 8 years ago

If you have a listening socket, is there an mbed3 api way to delay it processing accepts?

The server may choose to restrict some resource necessary for accepted connection processing, so that the number of simultaneous pending connects cannot affect total allocation of this resource. For example accepted connects may perform mallocs, if there is no management of the dynamic number of accepted connects the device can be DoS'd by firing a bunch of connect requests at it simultaneously.

In that case the best way to control it is when the resource pool is busy, listen socket accepts are stopped from happening, they are not rejected just on hold in the request queue. Normally in Posix this is explicitly done in the server and you modulate accepts by, eg, temporarily disabling the listen socket POLLIN on poll().

How can the same thing be achieved cleanly in mbed3?

ciarmcom commented 8 years ago

ARM Internal Ref: IOTSFW-1576

bremoran commented 8 years ago

If the backlog is filled, then any new connection requests will be dropped. Otherwise, there is a stop_listening API