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

-- 
hundred-and-one symptoms of being an internet addict:
93. New mail alarm on your palmtop annoys other churchgoers.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui