Skip to content

Commit

Permalink
support pty, fix #5275
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Mar 27, 2024
1 parent df3f3e3 commit 6c93753
Show file tree
Hide file tree
Showing 6 changed files with 1,224 additions and 449 deletions.
1 change: 1 addition & 0 deletions ext-src/php_swoole_cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ SW_API php_stream *php_swoole_create_stream_from_socket(php_socket_t _fd,
int domain,
int type,
int protocol STREAMS_DC);
SW_API php_stream *php_swoole_create_stream_from_pipe(int fd, const char *mode, const char *persistent_id STREAMS_DC);
SW_API php_stream_ops *php_swoole_get_ori_php_stream_stdio_ops();
SW_API void php_swoole_register_rshutdown_callback(swoole::Callback cb, void *private_data);

Expand Down
4 changes: 4 additions & 0 deletions ext-src/swoole_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,10 @@ php_stream *php_swoole_create_stream_from_socket(php_socket_t _fd, int domain, i
return stream;
}

php_stream *php_swoole_create_stream_from_pipe(int fd, const char *mode, const char *persistent_id STREAMS_DC) {
return _sw_php_stream_fopen_from_fd(fd, mode, persistent_id STREAMS_CC);
}

php_stream_ops *php_swoole_get_ori_php_stream_stdio_ops() {
return &ori_php_stream_stdio_ops;
}
Expand Down
8 changes: 4 additions & 4 deletions src/coroutine/hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ int swoole_coroutine_socket_create(int fd) {
int _fd = socket->get_fd();
if (sw_unlikely(_fd < 0)) {
return -1;
} else {
std::unique_lock<std::mutex> _lock(socket_map_lock);
socket_map[fd] = socket;
return 0;
}
socket->get_socket()->set_nonblock();
std::unique_lock<std::mutex> _lock(socket_map_lock);
socket_map[fd] = socket;
return 0;
}

int swoole_coroutine_socket_unwrap(int fd) {
Expand Down
Loading

0 comments on commit 6c93753

Please sign in to comment.