Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-27 Thread Willy Tarreau
On Tue, Mar 27, 2018 at 09:51:51AM +0200, Thierry Fournier wrote: > Thank Mark, > > Willy, could you apply the attached patch. > > For information, I updated doc and add comment in the commit message. Applied, thanks guys! willy

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-27 Thread Thierry Fournier
Thank Mark, Willy, could you apply the attached patch. For information, I updated doc and add comment in the commit message. Thierry 0001-MINOR-lua-allow-socket-api-settimeout-to-accept-inte.patch Description: Binary data > On 27 Mar 2018, at 06:49, Mark Lakes

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-26 Thread Mark Lakes
Hi Thierry, remade patch for support of number other than integer in hlua_socket_settimeout() ...from latest source so should be able to be applied. Desc: instead of accepting only integers, allow user to specify float and double when hlua_socket_settimeout() is called. Round up user specified

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-26 Thread Willy Tarreau
On Mon, Mar 26, 2018 at 12:40:19AM +0200, Willy Tarreau wrote: > > did you miss these patches from Thierry to the Lua subsystem? > > Hmmm seems so, I'll recheck tomorrow. Thanks. Now applied. Thanks for notifying! Willy

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-25 Thread Willy Tarreau
Hi Tim, On Mon, Mar 26, 2018 at 12:15:02AM +0200, Tim Düsterhus wrote: > Willy, > > Am 08.03.2018 um 21:15 schrieb Thierry Fournier: > > 3 new patch in attachement to consider for the initial subject of > > this thread. > > > > did you miss these patches from Thierry to the Lua subsystem?

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-25 Thread Tim Düsterhus
Willy, Am 08.03.2018 um 21:15 schrieb Thierry Fournier: > 3 new patch in attachement to consider for the initial subject of > this thread. > did you miss these patches from Thierry to the Lua subsystem? Best regards Tim Düsterhus

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-09 Thread Thierry Fournier
> On 8 Mar 2018, at 22:41, Tim Düsterhus wrote: > > Thierry, > > Am 08.03.2018 um 21:15 schrieb Thierry Fournier: >> Hey, the example of use of socket.http in attachment of your original >> commit is great ! > > If you are curious what I built with that and in case you

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Tim Düsterhus
Thierry, Am 08.03.2018 um 21:15 schrieb Thierry Fournier: > Hey, the example of use of socket.http in attachment of your original > commit is great ! If you are curious what I built with that and in case you missed my list mail advertising the project:

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Thierry Fournier
> On 8 Mar 2018, at 15:14, Tim Düsterhus wrote: > > Hi > > Am 08.03.2018 um 15:10 schrieb Thierry Fournier: >> Ok, Lua expect the number of elements ins the stack. The right way for >> returning 1 is: >> >> lua_pushinteger(L, 1); >>return 1; >> > > Okay, then my

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Tim Düsterhus
Hi Am 08.03.2018 um 15:10 schrieb Thierry Fournier: > Ok, Lua expect the number of elements ins the stack. The right way for > returning 1 is: > >lua_pushinteger(L, 1); > return 1; > Okay, then my patch probably worked, because of whatever value was left on the stack. I learned

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Thierry Fournier
> On 8 Mar 2018, at 15:03, Tim Düsterhus wrote: > > Thierry, > > Am 08.03.2018 um 10:24 schrieb Thierry Fournier: >> I forgot 3 things while my first read: >> >> - The Lua error are not trigerred with a return 1 (the return 1 is a bug >> in the original function), but

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Tim Düsterhus
Thierry, Am 08.03.2018 um 10:24 schrieb Thierry Fournier: > I forgot 3 things while my first read: > > - The Lua error are not trigerred with a return 1 (the return 1 is a bug >in the original function), but with something like that: > Your first patch will be regressing my commit

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-08 Thread Thierry Fournier
Hi Mark, Thanks, it seems perfect. But, I can’t apply on current master branch, the patch is rejected. I forgot 3 things while my first read: - The Lua error are not trigerred with a return 1 (the return 1 is a bug in the original function), but with something like that:

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-07 Thread Mark Lakes
Hi Thierry, thanks for feedback. Addressed concerns in the new attached patch. http://w3.impa.br/~diego/software/luasocket/tcp.html#settimeout Description: instead of hlua_socket_settimeout() accepting only integers, allow user to specify float and double as well. Convert to milliseconds much

Re: lua socket api settimeout in seconds vs. milliseconds

2018-03-07 Thread Thierry Fournier
Hi Mark, Thanks for the patch. I don’t like usage of floating point, but the luasocket documentation says that the settimeout() function accept only second. In this case, the usage of floating point seems be to be a good way. Can you split in a second commit the fix of comments from the

lua socket api settimeout in seconds vs. milliseconds

2018-03-07 Thread Mark Lakes
In regards to earlier conversation, herein is a patch attached for the feature. >From the mail archive: https://www.mail-archive.com/haproxy@formilux.org/msg27806.html https://www.mail-archive.com/haproxy@formilux.org/msg27807.html Mark Lakes Signal Sciences | www.signalsciences.com |

Re: lua socket api settimeout in seconds vs. milliseconds

2017-11-09 Thread Nick Galbreath
thanks wily. re: " CONTRIBUTING in the sources directory," - yes, that is what I was looking for! thanks for the tip. re: least it seems important to round up non-null values to the next millisecond. Definitely, we can and should add some checks for invalid values, etc. I'll read

Re: lua socket api settimeout in seconds vs. milliseconds

2017-11-09 Thread Willy Tarreau
Hi Nick, On Thu, Nov 09, 2017 at 08:27:29PM -0800, Nick Galbreath wrote: > Hello Adis, > > We could certainly add another API/Lua function but it might be easier to > change > > luaL_checkinteger(L, 2) in > > tmout = MAY_LJMP(luaL_checkinteger(L, 2)) * 1000; > > to luaL_checknumber(L, 2),

Re: lua socket api settimeout in seconds vs. milliseconds

2017-11-09 Thread Nick Galbreath
Hello Adis, We could certainly add another API/Lua function but it might be easier to change luaL_checkinteger(L, 2) in tmout = MAY_LJMP(luaL_checkinteger(L, 2)) * 1000; to luaL_checknumber(L, 2), along with appropriate cast to int. Then we have backwards compatibility, less documentation

Re: lua socket api settimeout in seconds vs. milliseconds

2017-11-08 Thread Adis Nezirovic
On 11/07/2017 08:49 PM, Nick Galbreath wrote: > I have a question regarding the socket:settimeout function. > > It appears to only accept an integer value for seconds, but internally > converts to milliseconds (see below). > > Is there a reason to enforce whole seconds, or could this be relaxed

lua socket api settimeout in seconds vs. milliseconds

2017-11-07 Thread Nick Galbreath
Hello, Thanks for a great Lua API! I have a question regarding the socket:settimeout function. It appears to only accept an integer value for seconds, but internally converts to milliseconds (see below). Is there a reason to enforce whole seconds, or could this be relaxed to accept a lua