-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Reverse: portal-worker should not be closed before making sure there is at least one other active worker #4869
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
Conversation
如果只是为了至少有一个活连接 正确的方法应该是把monitor()函数里的timer放入ClientWorker 然后在heartbeat()中发送drain消息前把timer重设为16秒 给客户端时间打开新的连接 而不是还丢个parentPicker进去 |
But, this doesn't help the "Iran-Access" problem (read the second reason) After becoming "Iran-Access", the new connection cannot be established from bridge-server to Iran-server. So after 16 seconds the only active worker is disconnected and new connection cannot be established.
|
我不觉得核心应该为只会发生一次两次的Internet shutdown的特殊行为做准备 持有父对象的引用是不太好的行为 这么实现还额外绕开内部draining机制 难懂又难看 而且即便是这样这样tcp连接不见得可以活太久 以及mux本来就有的硬上限65535摆在那 发送65535个请求后mux就没有多余的流ID了 总的来说可用面很小 还不如在外面开个mux或者用grpc和xhttp3之类的当底层传输 |
OK, I implemented your timer-reset idea instead. |
Xray-core/app/reverse/config.go Line 11 in cb1afb3
another problem is that, If
so UPDATE: it only affect keepAlive-hearbeat, not drain-notify-heartbeat |
那要不你试试drain数据包能不能发出去 |
I tested, I always test after making a change. set the |
你有试过这会导致drain数据包不会被发送导致超过256吗 |
if but heartbeat-packet has two roles drain-notify and keepAlive. and it is still cause some keepAlive packets is not sent.(If there are several consecutive fail-keepAlive, the connection may be disconnected) so |
我没有说不行 我只是说你臆想问题不是一回两回了。。 |
when a portal-worker is draining, heartbeat-reader/writer is immediately closed, this causes some problems, let explain why:
suppose we only have one active portal-worker and it starts draining.
also support the only sub-connection(session) of this worker is heartbeat-sub-connection and it has no client-sub-connection.
after heartbeat-sub-connection is closed, the number of sub-connection(session) of the worker reaches 0,
worker check every 16 seconds if there is no session(sub-connection), It closes itself.
So there is a chance that the worker will be closed after heartbeat-sub-connection is closed and before the new worker arrives from bridge-side.
So during this time, until a new worker is created and arrives from bridge-side, our connection with bridge-side will be completely broken, so if new sub-connection is received from the client-side, we can't connect it to the bridge-side.
so we need to check that there is at least one other active worker before closing heartbeat-sub-connection.
///
also, apart from the fact that our connection to the bridge-side can be interrupted for a moment, there is another reason for this change:
during Iran-Israel 12 days war, some Iran-servers become "Iran-Access", means they only accept connection from Iran-IP, but if the connection is established before becoming "Iran-Access" from foreign-IP, the connection wouldn't disconnect after becoming "Iran-Access".
so Xray-core should not disconnect a connection(worker), before making sure there is at least one other active connection (worker).
///
also, when worker is not draining, heartbeat period increase to 10 seconds.