Skip to content

Commit 6136389

Browse files
committed
Bug#35703454 NdbSocket refactoring - remove From::Existing [NOCLOSE]
Bug#35692840 Disable NDB SSL socket table Remove NdbSocket::From enum and init_from_native and init_from_new methods. Remove the SSL socket table. Change-Id: I6c0023ec1e3b06e519988d9388440d577e6f2e84
1 parent c3cf148 commit 6136389

File tree

9 files changed

+6
-203
lines changed

9 files changed

+6
-203
lines changed

storage/ndb/include/util/NdbSocket.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,18 @@
2929
#include "portlib/ndb_socket.h"
3030
#include "portlib/ndb_socket_poller.h"
3131
#include "portlib/NdbMutex.h"
32-
#include "util/ssl_socket_table.h"
3332

3433
static constexpr int TLS_BUSY_TRY_AGAIN = -2;
3534

3635
class NdbSocket {
3736
public:
38-
enum class From { New, Existing };
39-
4037
NdbSocket() = default;
4138
NdbSocket(NdbSocket&& oth);
42-
NdbSocket(ndb_socket_t ndbsocket, From fromType = From::New) {
43-
ssl = socket_table_get_ssl(ndbsocket.s, (fromType == From::Existing));
44-
init_from_native(ndbsocket.s);
45-
}
39+
// TODO: move ndb_socket_t into NdbSocket
40+
NdbSocket(ndb_socket_t ndbsocket): s(ndbsocket) {}
4641
~NdbSocket() { disable_locking(); }
4742
NdbSocket& operator=(NdbSocket &&);
4843

49-
void init_from_new(ndb_socket_t);
50-
void init_from_native(socket_t fd) { ndb_socket_init_from_native(s, fd); }
5144
int is_valid() const { return ndb_socket_valid(s); }
5245
bool has_tls() const { return ssl; }
5346
ndb_socket_t ndb_socket() const { return s; }
@@ -197,12 +190,6 @@ class NdbSocket {
197190
ndb_socket_t s{INVALID_SOCKET};
198191
};
199192

200-
inline
201-
void NdbSocket::init_from_new(ndb_socket_t ndbsocket) {
202-
assert(! socket_table_get_ssl(ndbsocket.s, false));
203-
init_from_native(ndbsocket.s);
204-
}
205-
206193
/*
207194
* There must not be any concurrent operations on the source object (oth) while
208195
* calling the move constructor.

storage/ndb/include/util/ssl_socket_table.h

Lines changed: 0 additions & 69 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Loopback_Transporter::connect_client()
5959
goto err;
6060
}
6161

62-
theSocket.init_from_new(pair[0]);
62+
theSocket = NdbSocket{pair[0]};
6363
m_send_socket = pair[1];
6464

6565
m_connected = true;

storage/ndb/src/common/util/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ ADD_CONVENIENCE_LIBRARY(ndbgeneral
7272
parse_mask.cpp
7373
random.cpp
7474
require.cpp
75-
ssl_socket_table.cpp
7675
socket_io.cpp
7776
version.cpp
7877
LINK_LIBRARIES ndbtrace ndbportlib ext::zlib mysys

storage/ndb/src/common/util/NdbSocket.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ bool NdbSocket::associate(SSL * new_ssl)
9999
if(ssl) return false; // already associated
100100
if(new_ssl == nullptr) return false;
101101
if(! SSL_set_fd(new_ssl, s.s)) return false;
102-
socket_table_set_ssl(s.s, new_ssl);
103102
ssl = new_ssl;
104103
return true;
105104
}
@@ -143,7 +142,6 @@ void NdbSocket::ssl_close() {
143142
Guard2 guard(mutex); // acquire mutex if non-null
144143
set_nonblocking(false); // set to blocking
145144
SSL_shutdown(ssl); // wait for close
146-
socket_table_clear_ssl(s.s);
147145
SSL_free(ssl);
148146
ssl = nullptr;
149147
}

storage/ndb/src/common/util/SocketClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ SocketClient::connect(ndb_sockaddr server_addr)
202202
ndb_socket_get_port(m_sockfd, &m_last_used_port);
203203

204204
// Transfer the fd to the NdbSocket
205-
NdbSocket secureSocket{m_sockfd, NdbSocket::From::New};
205+
NdbSocket secureSocket{m_sockfd};
206206
ndb_socket_invalidate(&m_sockfd);
207207
return secureSocket;
208208
}

storage/ndb/src/common/util/SocketServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ SocketServer::doAccept()
215215
ServiceInstance & si = m_services[i];
216216
assert(m_services_poller.is_socket_equal(i, si.m_socket));
217217

218-
NdbSocket childSock{ndb_accept(si.m_socket, nullptr), NdbSocket::From::New};
218+
NdbSocket childSock{ndb_accept(si.m_socket, nullptr)};
219219
if (!childSock.is_valid())
220220
{
221221
// Could not 'accept' socket(maybe at max fds), indicate error

storage/ndb/src/common/util/ssl_socket_table.cpp

Lines changed: 0 additions & 112 deletions
This file was deleted.

storage/ndb/test/src/CpcClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ int SimpleCpcClient::open_connection() {
460460
sa.set_port(port);
461461

462462
/* Create socket */
463-
cpc_sock = NdbSocket(ndb_socket_create(sa.get_address_family()), NdbSocket::From::Existing);
463+
cpc_sock = NdbSocket(ndb_socket_create(sa.get_address_family()));
464464
if (!cpc_sock.is_valid()) return -1;
465465

466466
if (sa.need_dual_stack())

0 commit comments

Comments
 (0)