api7 / lua-resty-ldap

Apache License 2.0
7 stars 6 forks source link

feat: support ldap v3 search #7

Closed bzp2010 closed 1 year ago

bzp2010 commented 1 year ago

Support building LDAPv3 search request and response data parsing.


In addition, the code uses receiveuntil and while true for reading data, which in my perception is a risk of blocking the worker, and I wonder if there is a good way to improve it (its description and reasons are in the code comments).

kingluo commented 1 year ago

In addition, the code uses receiveuntil and while true for reading data, which in my perception is a risk of blocking the worker, and I wonder if there is a good way to improve it (its description and reasons are in the code comments).

The loop of receiveuntil will not block the worker, even if the package is large, it's limited to the length of socket buffer.

bzp2010 commented 1 year ago

The loop of receiveuntil will not block the worker, even if the package is large, it's limited to the length of socket buffer.

@kingluo My concern is that if the data has already been read (i.e. there is no more data in the buffer), then calling the reader again will block until read timeout, at which point what is its behavior? 🤔

kingluo commented 1 year ago

The loop of receiveuntil will not block the worker, even if the package is large, it's limited to the length of socket buffer.

@kingluo My concern is that if the data has already been read (i.e. there is no more data in the buffer), then calling the reader again will block until read timeout, at which point what is its behavior? 🤔

receiveutil is a nonblocking method of cosocket, it just analyzes the data according to dfa pattern, which yields if it needs more data. Timeout event, if exists, will trigger next resume.

bzp2010 commented 1 year ago

receiveutil is a nonblocking method of cosocket, it just analyzes the data according to dfa pattern, which yields if it needs more data. Timeout event, if exists, will trigger next resume.

Get it, this means that that HTTP request that triggered the LDAP operation is stuck and doesn't block other requests, which is great.