forked from mooncake-track/Mooncake
[TE] fix(transfer): correct handshake daemon initialization order (#765)
Fix incorrect initialization sequence in startHandshakeDaemon by moving handshake_plugin_->startDaemon() call after callback registrations to ensure proper setup before daemon starts. Signed-off-by: staryxchen <staryxchen@tencent.com>
This commit is contained in:
parent
6fbb85b37c
commit
fc04a31cae
|
|
@ -672,11 +672,6 @@ int TransferMetadata::getRpcMetaEntry(const std::string &server_name,
|
|||
|
||||
int TransferMetadata::startHandshakeDaemon(
|
||||
OnReceiveHandShake on_receive_handshake, uint16_t listen_port, int sockfd) {
|
||||
int rc = handshake_plugin_->startDaemon(listen_port, sockfd);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
handshake_plugin_->registerOnConnectionCallBack(
|
||||
[on_receive_handshake](const Json::Value &peer,
|
||||
Json::Value &local) -> int {
|
||||
|
|
@ -693,6 +688,11 @@ int TransferMetadata::startHandshakeDaemon(
|
|||
[this](const Json::Value &peer, Json::Value &local) -> int {
|
||||
return receivePeerNotify(peer, local);
|
||||
});
|
||||
|
||||
int rc = handshake_plugin_->startDaemon(listen_port, sockfd);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue