[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/websocket 268a0726b8 062/114: execute handshake after p
From: |
ELPA Syncer |
Subject: |
[elpa] externals/websocket 268a0726b8 062/114: execute handshake after process status moved to open |
Date: |
Wed, 15 Feb 2023 20:59:00 -0500 (EST) |
branch: externals/websocket
commit 268a0726b80f04c1a08c84b0f01039b18b9c8ae0
Author: Yuya Minami <yuya373@me.com>
Commit: Yuya Minami <yuya373@me.com>
execute handshake after process status moved to open
if nowait is t, `open-network-stream` or `make-network-process`
function returns without waiting connection opened.
we need to wait executing handshake process until process status
changed to `open`.
we call `websocket-handshake` in sentinel because sentinel function is
executed when process status changed to `open`.
if nowait is nil, `open-network-stream` or `make-network-process`
returns after connection opened.
sentinel function is not executed when process-status changed to
`open`, we have to call `websocket-handshake` in `websocket-open`.
---
websocket.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/websocket.el b/websocket.el
index 3d83b3a950..01bbe6ea37 100644
--- a/websocket.el
+++ b/websocket.el
@@ -731,11 +731,21 @@ to the websocket protocol.
(lambda (process change)
(let ((websocket (process-get process :websocket)))
(websocket-debug websocket "State change to %s" change)
- (when (and
- (member (process-status process) '(closed failed exit signal))
- (not (eq 'closed (websocket-ready-state websocket))))
- (websocket-try-callback 'websocket-on-close 'on-close websocket)))))
+ (let ((status (process-status process)))
+ (when (and nowait (eq status 'open))
+ (websocket-handshake url conn key protocols extensions
custom-header-alist))
+
+ (when (and (member status '(closed failed exit signal))
+ (not (eq 'closed (websocket-ready-state websocket))))
+ (websocket-try-callback 'websocket-on-close 'on-close
websocket))))))
(set-process-query-on-exit-flag conn nil)
+ (unless nowait
+ (websocket-handshake url conn key protocols extensions
custom-header-alist))
+ websocket))
+
+(defun websocket-handshake (url conn key protocols extensions
custom-header-alist)
+ (let ((url-struct (url-generic-parse-url url))
+ (websocket (process-get conn :websocket)))
(process-send-string conn
(format "GET %s HTTP/1.1\r\n"
(let ((path (url-filename url-struct)))
@@ -745,8 +755,7 @@ to the websocket protocol.
(process-send-string conn
(websocket-create-headers
url key protocols extensions custom-header-alist))
- (websocket-debug websocket "Websocket opened")
- websocket))
+ (websocket-debug websocket "Websocket opened")))
(defun websocket-process-headers (url headers)
"On opening URL, process the HEADERS sent from the server."
- [elpa] externals/websocket 965fac0fe5 027/114: add markdown preview mode, (continued)
- [elpa] externals/websocket 965fac0fe5 027/114: add markdown preview mode, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 49a93b2218 028/114: Merge pull request #39 from ancane/master, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 90b9f03da0 029/114: Correctly parse fragmented HTTP header, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 8299e57a4c 033/114: Function test improvements for Windows: SIGSTP, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 4f8ddb64bc 034/114: Merge pull request #43 from chwarr/func-test-windows-sigstp, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 7422064ea6 035/114: Add a way to specify websocket-server listen host, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 923e74d686 038/114: Merge pull request #40 from ilysym/fragmented-header, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket f7d3fb5409 045/114: Fix issue with handling multibyte characters., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket ccbe93ac8b 049/114: Stop checking certs in functional test., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 33d0406901 057/114: Reflow function documentation., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 268a0726b8 062/114: execute handshake after process status moved to open,
ELPA Syncer <=
- [elpa] externals/websocket c045acb374 039/114: Add test for fragmented headers., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket f18bfea59b 043/114: Made functional tests compile cleanly., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 23ec19933d 050/114: Various idiomatic changes., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 99d3b3e695 053/114: need another sleep on my environment, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket c193d6f867 058/114: Add ability for clients to pass custom headers., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 058e8f4696 059/114: Fix issue with missing \r\n when using custom headers., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 7d2adf2187 061/114: Update version to 1.9., ELPA Syncer, 2023/02/15
- [elpa] externals/websocket d28b6b4633 065/114: ensure handshake is performed, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket 38c1f20cb3 066/114: ensure handshake called once, ELPA Syncer, 2023/02/15
- [elpa] externals/websocket d34f5f095d 070/114: Update version to 1.10., ELPA Syncer, 2023/02/15