Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tc_epoll_server 多个handle,只有一个在处理 #306

Open
sunhmk opened this issue May 9, 2024 · 3 comments
Open

tc_epoll_server 多个handle,只有一个在处理 #306

sunhmk opened this issue May 9, 2024 · 3 comments

Comments

@sunhmk
Copy link

sunhmk commented May 9, 2024

添加一个额外的udp adapter;
netthread 个数为4
handle个数也为4
只有一个handle能处理数据,其他三个无效;
Thread 14 "uac" hit Breakpoint 10, tars::TC_EpollServer::Connection::getId (
this=0x7fffe80022f0)
at /data/tarscpp/Tars/tarscpp/util/include/util/tc_epoll_server.h:535
535 inline uint32_t getId() const { return _uid; }
(gdb) p _uid
$36 = 4232052737
(gdb) p _uid
$37 = 4232052737
(gdb) c
Continuing.
[Switching to Thread 0x7fffdffff700 (LWP 1508)]

Thread 16 "uac" hit Breakpoint 10, tars::TC_EpollServer::Connection::getId (
this=0x7fffd8001aa0)
at /data/tarscpp/Tars/tarscpp/util/include/util/tc_epoll_server.h:535
535 inline uint32_t getId() const { return _uid; }
(gdb) p _uid
$38 = 4240441345
(gdb) c
Continuing.
[Switching to Thread 0x7fffecff9700 (LWP 1507)]

Thread 15 "***" hit Breakpoint 10, tars::TC_EpollServer::Connection::getId (
this=0x7fffe4001aa0)
at ..../tarscpp/util/include/util/tc_epoll_server.h:535
535 inline uint32_t getId() const { return _uid; }
(gdb) p _uid
$39 = 4236247041
(gdb) c
Continuing.
[Switching to Thread 0x7fffdf7fe700 (LWP 1509)]

Thread 17 "***" hit Breakpoint 10, tars::TC_EpollServer::Connection::getId (
this=0x7fffd0001aa0)
at ..../tarscpp/util/include/util/tc_epoll_server.h:535
535 inline uint32_t getId() const { return _uid; }
(gdb) p _uid
$40 = 4244635649

(gdb) p 4232052737 % 4
$1 = 1
(gdb) p 4240441345 % 4
$2 = 1
(gdb) p 4236247041 % 4
$3 = 1
(gdb) p 4244635649 % 4
$4 = 1

@ruanshudong
Copy link
Contributor

启用了队列模式?

@sunhmk
Copy link
Author

sunhmk commented May 9, 2024

是的。
请教下,udp服务端,如果还希望每次接收到来自同一个客户端的数据由同一个handle处理,怎么处理比较高效?

启用了队列模式?

@ruanshudong
Copy link
Contributor

udp启用队列模式没用, 因为句柄只有一个, 这种情况, 估计你得自己处理了, 到handle以后, 自己根据来源, 分到自己的线程处理了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants