Skip to content

Commit

Permalink
Merge c95926d into 4f2927a
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Oct 3, 2018
2 parents 4f2927a + c95926d commit 6228efd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ServerSocket.php
Expand Up @@ -13,6 +13,15 @@ public function enableCrypto(): Promise {
return new Failure(new ClosedException("The socket has been closed"));
}

$ctx = \stream_context_get_options($resource);
if (empty($ctx['ssl'])) {
return new Failure(new SocketException(
"Can't enable TLS without configuration. " .
"If you used Amp\\Socket\\listen(), be sure to pass a ServerTlsContext as third argument, " .
"otherwise set the 'ssl' context option to the PHP stream resource."
));
}

return Internal\enableCrypto($resource, [], true);
}
}

0 comments on commit 6228efd

Please sign in to comment.