File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,8 @@ protected function establishSocketConnection(): void
264
264
// from some unrelated code of the users application.
265
265
error_clear_last ();
266
266
267
+ $ this ->logger ->debug ('Enabling TLS on the existing socket connection. ' );
268
+
267
269
$ enableEncryptionResult = @stream_socket_enable_crypto ($ socket , true , STREAM_CRYPTO_METHOD_ANY_CLIENT );
268
270
269
271
if ($ enableEncryptionResult === false ) {
@@ -291,9 +293,14 @@ protected function establishSocketConnection(): void
291
293
$ tlsErrorMessage
292
294
);
293
295
}
296
+
297
+ $ this ->logger ->debug ('TLS enabled successfully. ' );
294
298
}
295
299
296
300
stream_set_timeout ($ socket , $ this ->settings ->getSocketTimeout ());
301
+ stream_set_blocking ($ socket , false );
302
+
303
+ $ this ->logger ->debug ('Socket opened and ready to use. ' );
297
304
298
305
$ this ->socket = $ socket ;
299
306
}
@@ -1103,11 +1110,8 @@ protected function disconnect(): void
1103
1110
*/
1104
1111
protected function writeToSocket (string $ data , int $ length = null ): void
1105
1112
{
1106
- if ($ length === null ) {
1107
- $ length = strlen ($ data );
1108
- }
1109
-
1110
- $ length = min ($ length , strlen ($ data ));
1113
+ $ calculatedLength = strlen ($ data );
1114
+ $ length = min ($ length ?? $ calculatedLength , $ calculatedLength );
1111
1115
1112
1116
$ result = @fwrite ($ this ->socket , $ data , $ length );
1113
1117
You can’t perform that action at this time.
0 commit comments