branch: externals/websocket commit 992ef33e4663abd6963cf95ee102f59e59e60c8f Author: Yuya Minami <yuya...@me.com> Commit: Yuya Minami <yuya...@me.com>
Fix `process-status` returns `'connect` when nowait --- websocket.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/websocket.el b/websocket.el index b2fe6d9612..a6521ecae4 100644 --- a/websocket.el +++ b/websocket.el @@ -722,7 +722,7 @@ to the websocket protocol. conn (websocket-sentinel url conn key protocols extensions custom-header-alist nowait)) (set-process-query-on-exit-flag conn nil) - (websocket-ensure-handshake url conn key protocols extensions custom-header-alist) + (websocket-ensure-handshake url conn key protocols extensions custom-header-alist nowait) websocket)) (defun websocket-sentinel (url conn key protocols extensions custom-header-alist nowait) @@ -731,17 +731,19 @@ to the websocket protocol. (websocket-debug websocket "State change to %s" change) (let ((status (process-status process))) (when (and nowait (eq status 'open)) - (websocket-ensure-handshake url conn key protocols extensions custom-header-alist)) + (websocket-ensure-handshake url conn key protocols extensions custom-header-alist nowait)) (when (and (member status '(closed failed exit signal)) (not (eq 'closed (websocket-ready-state websocket)))) (websocket-try-callback 'websocket-on-close 'on-close websocket)))))) -(defun websocket-ensure-handshake (url conn key protocols extensions custom-header-alist) +(defun websocket-ensure-handshake (url conn key protocols extensions custom-header-alist nowait) (let ((url-struct (url-generic-parse-url url)) (websocket (process-get conn :websocket))) - (when (and (eq 'connecting (websocket-ready-state websocket)) - (eq 'open (process-status conn))) + (when(and (eq 'connecting (websocket-ready-state websocket)) + (eq (process-status conn) + (or (and nowait 'connect) + 'open))) (process-send-string conn (format "GET %s HTTP/1.1\r\n" (let ((path (url-filename url-struct)))