Skip to content

Commit 91380b3

Browse files
committed
Fix tests and optimize code
1 parent 807bcf1 commit 91380b3

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

ext-src/php_swoole_cxx.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ void array_add_or_merge(zval *zarray, const char *key, size_t key_len, zval *new
7171
zval *zresult = sw_zend_symtable_str_add(array, key, key_len, idx, numeric_key, new_element);
7272
// Adding element failed, indicating that this key already exists and must be converted to an array
7373
if (!zresult) {
74-
zval *current_header = sw_zend_symtable_str_find(array, key, key_len, idx, numeric_key);
75-
if (ZVAL_IS_ARRAY(current_header)) {
76-
add_next_index_zval(current_header, new_element);
74+
zval *current_elements = sw_zend_symtable_str_find(array, key, key_len, idx, numeric_key);
75+
if (ZVAL_IS_ARRAY(current_elements)) {
76+
add_next_index_zval(current_elements, new_element);
7777
} else {
7878
zval zvalue_array;
7979
array_init_size(&zvalue_array, 2);
80-
Z_ADDREF_P(current_header);
81-
add_next_index_zval(&zvalue_array, current_header);
80+
Z_ADDREF_P(current_elements);
81+
add_next_index_zval(&zvalue_array, current_elements);
8282
add_next_index_zval(&zvalue_array, new_element);
8383
sw_zend_symtable_str_update(array, key, key_len, idx, numeric_key, &zvalue_array);
8484
}

src/core/base.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ void swoole_redirect_stdout(int new_fd) {
617617
}
618618

619619
void swoole_redirect_stdout(const char *file) {
620-
auto fd = open(file, O_WRONLY | O_APPEND | O_CREAT);
620+
auto fd = open(file, O_WRONLY | O_APPEND | O_CREAT, 0644);
621621
if (fd >= 0) {
622622
swoole_redirect_stdout(fd);
623623
close(fd);

src/protocol/ssl.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ void swoole_ssl_init(void) {
6464
SSL_library_init();
6565
SSL_load_error_strings();
6666
OpenSSL_add_all_algorithms();
67+
OpenSSL_add_all_ciphers();
68+
OpenSSL_add_all_digests();
6769
#endif
6870

6971
ssl_connection_index = SSL_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
@@ -496,7 +498,6 @@ bool SSLContext::create() {
496498

497499
SSL_CTX_set_session_id_context(context, (const unsigned char *) "HTTP", sizeof("HTTP") - 1);
498500
SSL_CTX_set_session_cache_mode(context, SSL_SESS_CACHE_SERVER);
499-
SSL_CTX_sess_set_cache_size(context, 1);
500501
}
501502
#endif
502503

@@ -669,7 +670,7 @@ bool SSLContext::set_dhparam() {
669670

670671
#if OPENSSL_VERSION_MAJOR >= 3
671672
EVP_PKEY *pkey = PEM_read_bio_Parameters(bio, nullptr);
672-
if (pkey == nullptr) {
673+
if (pkey == nullptr) {
673674
swoole_warning("PEM_read_bio_Parameters('%s') failed", file);
674675
BIO_free(bio);
675676
return false;
@@ -681,8 +682,6 @@ bool SSLContext::set_dhparam() {
681682
BIO_free(bio);
682683
return false;
683684
}
684-
685-
EVP_PKEY_free(pkey);
686685
#else
687686
DH *dh = PEM_read_bio_DHparams(bio, nullptr, nullptr, nullptr);
688687
if (dh == nullptr) {

0 commit comments

Comments
 (0)