Meadow のネットワーク非同期通信の実装に一部おかしなところがあるようです。
具体的には make-network-process<f>で :nowait tを指定してコネクションを
作成した後、プロセス状態がconnectからopenに移行するのを待とうとして
accept-process-output<f>を使うと、いつまでたってもopenにならない
というもの。sit-for<f>で状態変化を待つと、こちらはうまくいきます。
再現コードは以下のようなもの。
後半の"切り替え"の部分を t にすると sit-for<f> で時間をつぶし、
nil だと accept-process-output<f> で行います。
UNIX上のEmacs 22.0.90だといずれのケースでも動作しますが、
Meadowだと nil の場合、つまり accept-process-output<f>を使う場合に問題があります。
r4180を使って試していますが、これは以前からあった問題のようです。
(let ((proc (make-network-process
:name "test"
:buffer (current-buffer)
:host "farm.meadowy.org"
:service 22
:filter 'myfilter
:sentinel 'mysentinel
:nowait t
)))
(while (not (member (process-status proc) '(open run closed)))
(list-processes)
(message "waiting")
(if t ;;; <<=== 切り替え
(sit-for 0.5)
(if (accept-process-output nil 1)
(message "accepted")
(message "timeout"))))
(process-send-eof "test")
(list-processes)
)
具体的な支障としてはurlライブラリでのネットワーク接続に支障が出ます。
なので、それなりに影響が大きいのではないかと思います。
以下の単純なコードは返って来ません。ネットワーク的にはコネクト済みなのに
Meadowがそう認識しないため、待ち続けます。
(url-retrieve-synchronously "http://www.meadowy.org/")
ちなみに最近のurl-gw.elの変更で :nowait (featurep 'make-network-process '(:nowait t))
という指定になったため影響が表に出てきました。
これを暫定的に回避するには以下のパッチで非同期を使わないようにすればOK.
-
url-gw.el
| old |
new |
|
| 253 | 253 | ;; Use non-blocking socket if we can. |
|---|
| 254 | 254 | (make-network-process :name name :buffer buffer |
|---|
| 255 | 255 | :host host :service service |
|---|
| 256 | | :nowait |
|---|
| 257 | | (featurep 'make-network-process '(:nowait t)))) |
|---|
| | 256 | :nowait nil)) |
|---|
| | 257 | ;;(featurep 'make-network-process '(:nowait t)))) |
|---|
| 258 | 258 | (socks |
|---|
| 259 | 259 | (socks-open-network-stream name buffer host service)) |
|---|
| 260 | 260 | (telnet |