@@ -29,7 +29,7 @@ public function __construct(?Socket\SocketConnector $connector = null, ?ConnectC
2929
3030 public function create (
3131 Request $ request ,
32- Cancellation $ cancellationToken
32+ Cancellation $ cancellation
3333 ): Connection {
3434 foreach ($ request ->getEventListeners () as $ eventListener ) {
3535 $ eventListener ->startConnectionCreation ($ request );
@@ -103,15 +103,15 @@ public function create(
103103 $ socket = $ connector ->connect (
104104 'tcp:// ' . $ authority ,
105105 $ connectContext ->withConnectTimeout ($ request ->getTcpConnectTimeout ()),
106- $ cancellationToken
106+ $ cancellation
107107 );
108108 } catch (Socket \ConnectException $ e ) {
109109 throw new UnprocessedRequestException (
110110 new SocketException (\sprintf ("Connection to '%s' failed " , $ authority ), 0 , $ e )
111111 );
112112 } catch (CancelledException $ e ) {
113113 // In case of a user cancellation request, throw the expected exception
114- $ cancellationToken ->throwIfRequested ();
114+ $ cancellation ->throwIfRequested ();
115115
116116 // Otherwise we ran into a timeout of our TimeoutCancellation
117117 throw new UnprocessedRequestException (new TimeoutException (\sprintf (
@@ -138,7 +138,7 @@ public function create(
138138 }
139139
140140 $ tlsCancellation = new CompositeCancellation (
141- $ cancellationToken ,
141+ $ cancellation ,
142142 new TimeoutCancellation ($ request ->getTlsHandshakeTimeout ())
143143 );
144144
@@ -159,7 +159,7 @@ public function create(
159159 $ socket ->close ();
160160
161161 // In case of a user cancellation request, throw the expected exception
162- $ cancellationToken ->throwIfRequested ();
162+ $ cancellation ->throwIfRequested ();
163163
164164 // Otherwise we ran into a timeout of our TimeoutCancellation
165165 throw new UnprocessedRequestException (new TimeoutException (\sprintf (
@@ -182,7 +182,7 @@ public function create(
182182
183183 if ($ tlsInfo ->getApplicationLayerProtocol () === 'h2 ' ) {
184184 $ http2Connection = new Http2Connection ($ socket );
185- $ http2Connection ->initialize ();
185+ $ http2Connection ->initialize ($ cancellation );
186186
187187 foreach ($ request ->getEventListeners () as $ eventListener ) {
188188 $ eventListener ->completeConnectionCreation ($ request );
@@ -195,7 +195,7 @@ public function create(
195195 // Treat the presence of only HTTP/2 as prior knowledge, see https://http2.github.io/http2-spec/#known-http
196196 if ($ request ->getProtocolVersions () === ['2 ' ]) {
197197 $ http2Connection = new Http2Connection ($ socket );
198- $ http2Connection ->initialize ();
198+ $ http2Connection ->initialize ($ cancellation );
199199
200200 foreach ($ request ->getEventListeners () as $ eventListener ) {
201201 $ eventListener ->completeConnectionCreation ($ request );
0 commit comments