File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 62
62
(-> ssl-handler
63
63
.handshakeFuture
64
64
netty/wrap-future
65
- (d/on-realized (fn [_]
66
- (call-handler ctx))
65
+ (d/on-realized (fn [ok?]
66
+ ; ; See
67
+ ; ; https://github.com/clj-commons/aleph/issues/618
68
+ ; ; for why this conditional is necessary
69
+ (when ok?
70
+ (call-handler ctx)))
67
71
; ; No need to handle errors here since
68
72
; ; the SSL handler will terminate the
69
73
; ; whole pipeline by throwing a
Original file line number Diff line number Diff line change 61
61
:trust-store (into-array X509Certificate [ssl/ca-cert])})})]
62
62
(is (nil? @(s/take! c)))
63
63
(is (nil? @ssl-session) " SSL session should be undefined" )))))
64
+
65
+ (deftest test-connection-close-during-ssl-handshake
66
+ (let [ssl-session (atom nil )
67
+ connection-closed (promise )
68
+ notify-connection-closed (netty/channel-handler
69
+ :channel-inactive
70
+ ([_ ctx]
71
+ (deliver connection-closed true )
72
+ (.fireChannelInactive ctx)))]
73
+ (with-server (tcp/start-server (ssl-echo-handler ssl-session)
74
+ {:port 10001
75
+ :ssl-context ssl/server-ssl-context
76
+ :pipeline-transform (fn [p]
77
+ (.addLast p notify-connection-closed))})
78
+ (let [c @(tcp/client {:host " localhost"
79
+ :port 10001 })]
80
+ (s/close! c)
81
+ (is (deref connection-closed 1000 false ))
82
+ (is (nil? @ssl-session) " SSL session should be undefined" )))))
You can’t perform that action at this time.
0 commit comments