On Tuesday, February 2, 2016 at 6:35:07 AM UTC+9, Bram Moolenaar wrote:
> Yasuhiro Matsumoto wrote:
>
> > connect() doesn't have timeout. So when server is down, connect()
> > hangs while 1 or 2 minuts. Below is a patch to add timeout query like
> > URL.
> >
> > connect("localhost:12345?timeout=3")
> >
> > https://gist.github.com/mattn/867a635e14ac2360613a
> >
> > But I'm thinking there is another ways to specify {timeout} like below.
> >
> >
> > connect("localhost:12345", {"type": "raw", "timeout": 3})
> >
> > How do you think?
>
> Thanks. Yes, we need to be able to specify a timeout. Both for making
> the connection and for waiting for a response.
>
> Since the number of options is likely to increase, using a dict instead
> of positional arguments is appropriate. We do need default values:
>
> mode default "json"
> callback default: none
> waittime default: zero (waiting for the server)
> timeout default: 1 second (waiting for response)
>
> Something like that. Could also use a separate call to set the response
> timeout, like there is a way to set the callback with sethandler().
> We could end up with lots of functions though. perhaps a channelconfig()
> function with a dict argument is better.
>
> I think we should normally assume that the server is already running.
> This allows for using a connect() call to check for that, and allow for
> starting the server if it fails.
>
> let handle = connect("localhost:1234")
> if handle < 0
> call StartServer()
> let handle = connect("localhost:1234" {"waittime": 3})
> endif
Well, when the {callback} is specified in the dict and 3rd argument either,
which is used?
connect("localhost:12345", "json", "Callback")
connect("localhost:12345", {"mode": "json", "callback": "Callback"},
"AnotherCallback")
- mattn
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.