Skip to content

Commit

Permalink
Allow binding to a random port (#3825)
Browse files Browse the repository at this point in the history
  • Loading branch information
twose authored Nov 9, 2020
1 parent 1464b56 commit 31cf895
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext-src/swoole_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void php_swoole_client_check_setting(Client *cli, zval *zset) {
if (php_swoole_array_get_value(vht, "bind_address", ztmp)) {
bind_address = zend::String(ztmp).to_std_string();
}
if (bind_port > 0 || bind_address.length() > 0) {
if (bind_address.length() > 0) {
cli->socket->bind(bind_address, &bind_port);
}
/**
Expand Down
2 changes: 1 addition & 1 deletion ext-src/swoole_client_coro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ bool php_swoole_client_set(Socket *cli, zval *zset) {
zend::String tmp = ztmp;
_bind_address = tmp.to_std_string();
}
if ((_bind_port > 0 || !_bind_address.empty()) && !cli->bind(_bind_address, _bind_port)) {
if (!_bind_address.empty() && !cli->bind(_bind_address, _bind_port)) {
ret = false;
}
/**
Expand Down

0 comments on commit 31cf895

Please sign in to comment.