Skip to content

Commit 7a2e83d

Browse files
committed
WL#15524 Patch #2 TLS-safe upgrade of mgm socket to transporter
Post push fix. NdbSocket::copy method duplicated the mutex pointer, leaving two objects referring to one mutex. Typically the source will destroy its mutex, making it unusable for target object. Fix by use the transfer method instead. Change-Id: I199c04b870049498463903f6358f79a38649f543
1 parent df6eef4 commit 7a2e83d

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

storage/ndb/include/util/NdbSocket.h

-4
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@ class NdbSocket {
4747
* NdbSockets should be copied using NdbSocket::transfer(), which
4848
* invalidates the original, and transfers ownership of its ssl and
4949
* mutex.
50-
*
51-
* NdbSocket::copy() should only be used when the original is going
52-
* out of scope.
5350
*/
5451
static void transfer(NdbSocket & newSocket, NdbSocket & original);
5552
static NdbSocket transfer(NdbSocket & original);
56-
static NdbSocket copy(const NdbSocket &s) { return s; }
5753

5854
void init_from_new(ndb_socket_t);
5955
void init_from_native(socket_t fd) { ndb_socket_init_from_native(s, fd); }

storage/ndb/src/common/transporter/TransporterRegistry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3860,7 +3860,7 @@ NdbSocket TransporterRegistry::connect_ndb_mgmd(NdbMgmHandle *h)
38603860
__FILE__, __LINE__);
38613861
ndb_mgm_destroy_handle(h);
38623862
}
3863-
DBUG_RETURN(NdbSocket::copy(socket));
3863+
DBUG_RETURN(NdbSocket::transfer(socket));
38643864
}
38653865

38663866
/**

0 commit comments

Comments
 (0)