PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 131
/* +----------------------------------------------------------------------+ | Swoole | +----------------------------------------------------------------------+ | This source file is subject to version 2.0 of the Apache license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.apache.org/licenses/LICENSE-2.0.html | | If you did not receive a copy of the Apache2.0 license and are unable| | to obtain it through the world-wide-web, please send a note to | | license@swoole.com so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Tianfeng Han | | Twosee | +----------------------------------------------------------------------+ */ #pragma once #include "swoole.h" #include #include #include "swoole_lock.h" #include "swoole_pipe.h" #include "swoole_channel.h" #include "swoole_msg_queue.h" #include "swoole_message_bus.h" enum swWorkerStatus { SW_WORKER_BUSY = 1, SW_WORKER_IDLE = 2, SW_WORKER_EXIT = 3, }; enum swIPCMode { SW_IPC_NONE = 0, SW_IPC_UNIXSOCK = 1, SW_IPC_MSGQUEUE = 2, SW_IPC_SOCKET = 3, }; namespace swoole { enum WorkerMessageType { SW_WORKER_MESSAGE_STOP = 1, }; enum ProtocolType { SW_PROTOCOL_TASK = 1, SW_PROTOCOL_STREAM, SW_PROTOCOL_MESSAGE, }; struct WorkerStopMessage { pid_t pid; uint16_t worker_id; }; class ExitStatus { private: pid_t pid_; int status_; public: ExitStatus(pid_t _pid, int _status) : pid_(_pid), status_(_status) {} pid_t get_pid() const { return pid_; } int get_status() const { return status_; } int get_code() const { return WEXITSTATUS(status_); } int get_signal() const { return WTERMSIG(status_); } bool is_normal_exit() { return WIFEXITED(status_); } }; static inline ExitStatus wait_process() { int status = 0; pid_t pid = ::wait(&status); return ExitStatus(pid, status); } static inline ExitStatus wait_process(pid_t _pid, int options) { int status = 0; pid_t pid = ::waitpid(_pid, &status, options); return ExitStatus(pid, status); } struct ProcessPool; struct Worker; struct WorkerGlobal { bool shutdown; bool running; uint32_t max_request; /** * worker is shared memory, visible in other work processes. * When a worker process restarts, it may be held by both the old and new processes simultaneously, * necessitating careful handling of the state. */ Worker *worker; /** * worker_copy is a copy of worker, * but it must be local memory and only used within the current process or thread. * It is not visible to other worker processes. */ Worker *worker_copy; time_t exit_time; }; struct Worker { pid_t pid; WorkerId id; ProcessPool *pool; MsgQueue *queue; bool shared; bool redirect_stdout; bool redirect_stdin; bool redirect_stderr; /** * worker status, IDLE or BUSY */ uint8_t status; uint8_t type; uint8_t msgqueue_mode; uint8_t child_process; uint32_t concurrency; time_t start_time; sw_atomic_long_t dispatch_count; sw_atomic_long_t request_count; sw_atomic_long_t response_count; size_t coroutine_num; Mutex *lock; UnixSocket *pipe_object; network::Socket *pipe_master; network::Socket *pipe_worker; network::Socket *pipe_current; void *ptr; void *ptr2; ssize_t send_pipe_message(const void *buf, size_t n, int flags); bool has_exceeded_max_request(); void set_max_request(uint32_t max_request, uint32_t max_request_grace); void report_error(const ExitStatus &exit_status); /** * Init global state for worker process. * Must be called after the process is spawned and before the main loop is executed. */ void init(); void shutdown(); bool is_shutdown(); bool is_running(); void set_status(enum swWorkerStatus _status) { status = _status; } void set_status_to_idle() { set_status(SW_WORKER_IDLE); } void set_status_to_busy() { set_status(SW_WORKER_BUSY); } void add_request_count() { request_count++; } bool is_busy() { return status == SW_WORKER_BUSY; } bool is_idle() { return status == SW_WORKER_IDLE; } }; struct StreamInfo { network::Socket *socket; network::Socket *last_connection; char *socket_file; int socket_port; String *response_buffer; }; struct ProcessPool { /** * reloading */ bool reloading; bool running; bool reload_init; bool read_message; bool started; bool schedule_by_sysvmsg; bool async; uint8_t ipc_mode; enum ProtocolType protocol_type_; pid_t master_pid; uint32_t reload_worker_i; uint32_t max_wait_time; uint64_t reload_count; time_t reload_last_time; Worker *reload_workers; /** * process type */ uint8_t type; /** * worker->id = start_id + i */ uint16_t start_id; /** * use message queue IPC */ uint8_t use_msgqueue; /** * use stream socket IPC */ uint8_t use_socket; char *packet_buffer; uint32_t max_packet_size_; /** * message queue key */ key_t msgqueue_key; uint32_t worker_num; uint32_t max_request; uint32_t max_request_grace; /** * No idle task work process is available. */ uint8_t scheduler_warning; time_t warning_time; void (*onStart)(ProcessPool *pool); void (*onShutdown)(ProcessPool *pool); int (*onTask)(ProcessPool *pool, Worker *worker, EventData *task); void (*onWorkerStart)(ProcessPool *pool, Worker *worker); void (*onMessage)(ProcessPool *pool, RecvData *msg); void (*onWorkerExit)(ProcessPool *pool, Worker *worker); void (*onWorkerStop)(ProcessPool *pool, Worker *worker); void (*onWorkerError)(ProcessPool *pool, Worker *worker, const ExitStatus &exit_status); void (*onWorkerMessage)(ProcessPool *pool, EventData *msg); int (*onWorkerNotFound)(ProcessPool *pool, const ExitStatus &exit_status); int (*main_loop)(ProcessPool *pool, Worker *worker); sw_atomic_t round_id; Worker *workers; std::vector> *pipes; std::unordered_map *map_; MsgQueue *queue; StreamInfo *stream_info_; Channel *message_box = nullptr; MessageBus *message_bus = nullptr; void *ptr; void set_type(int _type) { uint32_t i; type = _type; for (i = 0; i < worker_num; i++) { workers[i].type = type; } } void set_start_id(int _start_id) { uint32_t i; start_id = _start_id; for (i = 0; i < worker_num; i++) { workers[i].id = start_id + i; } } Worker *get_worker(int worker_id) { return &(workers[worker_id - start_id]); } Worker *get_worker_by_pid(pid_t pid) { auto iter = map_->find(pid); if (iter == map_->end()) { return nullptr; } return iter->second; } TaskId get_task_id(EventData *task) { return task->info.fd; } WorkerId get_task_src_worker_id(EventData *task) { return task->info.reactor_id; } void set_max_packet_size(uint32_t _max_packet_size) { max_packet_size_ = _max_packet_size; } bool is_master() { return swoole_get_process_type() == SW_PROCESS_MASTER; } bool is_worker() { return swoole_get_process_type() == SW_PROCESS_WORKER; } void set_protocol(enum ProtocolType _protocol_type); void set_max_request(uint32_t _max_request, uint32_t _max_request_grace); int get_max_request(); bool detach(); int wait(); int start_check(); int start(); void shutdown(); bool reload(); pid_t spawn(Worker *worker); void stop(Worker *worker); void kill_all_workers(int signo = SIGKILL); swResultCode dispatch(EventData *data, int *worker_id); int response(const char *data, int length); swResultCode dispatch_blocking(EventData *data, int *dst_worker_id); swResultCode dispatch_blocking(const char *data, uint32_t len); void add_worker(Worker *worker); int del_worker(Worker *worker); void destroy(); int create(uint32_t worker_num, key_t msgqueue_key = 0, swIPCMode ipc_mode = SW_IPC_NONE); int create_message_box(size_t memory_size); int create_message_bus(); int push_message(uint8_t type, const void *data, size_t length); int push_message(EventData *msg); int pop_message(void *data, size_t size); int listen(const char *socket_file, int blacklog); int listen(const char *host, int port, int blacklog); int schedule(); bool is_worker_running(Worker *worker); static void kill_timeout_worker(Timer *timer, TimerNode *tnode); private: static int run_with_task_protocol(ProcessPool *pool, Worker *worker); static int run_with_stream_protocol(ProcessPool *pool, Worker *worker); static int run_with_message_protocol(ProcessPool *pool, Worker *worker); static int run_async(ProcessPool *pool, Worker *worker); }; }; // namespace swoole static sw_inline int swoole_waitpid(pid_t __pid, int *__stat_loc, int __options) { int ret; do { ret = waitpid(__pid, __stat_loc, __options); } while (ret < 0 && errno == EINTR); return ret; } static sw_inline int swoole_kill(pid_t __pid, int __sig) { return kill(__pid, __sig); } typedef swoole::ProtocolType swProtocolType; extern SW_THREAD_LOCAL swoole::WorkerGlobal SwooleWG; static inline swoole::Worker *sw_worker() { return SwooleWG.worker; }