@@ -29,7 +29,7 @@ public function __construct(?Socket\SocketConnector $connector = null, ?ConnectC
29
29
30
30
public function create (
31
31
Request $ request ,
32
- Cancellation $ cancellationToken
32
+ Cancellation $ cancellation
33
33
): Connection {
34
34
foreach ($ request ->getEventListeners () as $ eventListener ) {
35
35
$ eventListener ->startConnectionCreation ($ request );
@@ -103,15 +103,15 @@ public function create(
103
103
$ socket = $ connector ->connect (
104
104
'tcp:// ' . $ authority ,
105
105
$ connectContext ->withConnectTimeout ($ request ->getTcpConnectTimeout ()),
106
- $ cancellationToken
106
+ $ cancellation
107
107
);
108
108
} catch (Socket \ConnectException $ e ) {
109
109
throw new UnprocessedRequestException (
110
110
new SocketException (\sprintf ("Connection to '%s' failed " , $ authority ), 0 , $ e )
111
111
);
112
112
} catch (CancelledException $ e ) {
113
113
// In case of a user cancellation request, throw the expected exception
114
- $ cancellationToken ->throwIfRequested ();
114
+ $ cancellation ->throwIfRequested ();
115
115
116
116
// Otherwise we ran into a timeout of our TimeoutCancellation
117
117
throw new UnprocessedRequestException (new TimeoutException (\sprintf (
@@ -138,7 +138,7 @@ public function create(
138
138
}
139
139
140
140
$ tlsCancellation = new CompositeCancellation (
141
- $ cancellationToken ,
141
+ $ cancellation ,
142
142
new TimeoutCancellation ($ request ->getTlsHandshakeTimeout ())
143
143
);
144
144
@@ -159,7 +159,7 @@ public function create(
159
159
$ socket ->close ();
160
160
161
161
// In case of a user cancellation request, throw the expected exception
162
- $ cancellationToken ->throwIfRequested ();
162
+ $ cancellation ->throwIfRequested ();
163
163
164
164
// Otherwise we ran into a timeout of our TimeoutCancellation
165
165
throw new UnprocessedRequestException (new TimeoutException (\sprintf (
@@ -182,7 +182,7 @@ public function create(
182
182
183
183
if ($ tlsInfo ->getApplicationLayerProtocol () === 'h2 ' ) {
184
184
$ http2Connection = new Http2Connection ($ socket );
185
- $ http2Connection ->initialize ();
185
+ $ http2Connection ->initialize ($ cancellation );
186
186
187
187
foreach ($ request ->getEventListeners () as $ eventListener ) {
188
188
$ eventListener ->completeConnectionCreation ($ request );
@@ -195,7 +195,7 @@ public function create(
195
195
// Treat the presence of only HTTP/2 as prior knowledge, see https://http2.github.io/http2-spec/#known-http
196
196
if ($ request ->getProtocolVersions () === ['2 ' ]) {
197
197
$ http2Connection = new Http2Connection ($ socket );
198
- $ http2Connection ->initialize ();
198
+ $ http2Connection ->initialize ($ cancellation );
199
199
200
200
foreach ($ request ->getEventListeners () as $ eventListener ) {
201
201
$ eventListener ->completeConnectionCreation ($ request );
0 commit comments