@@ -64,7 +64,8 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
64
64
DBUG_RETURN (0 );
65
65
}
66
66
67
- if (!m_transporter_registry->connect_server (sockfd))
67
+ BaseString msg;
68
+ if (!m_transporter_registry->connect_server (sockfd, msg))
68
69
{
69
70
NDB_CLOSE_SOCKET (sockfd);
70
71
DBUG_RETURN (0 );
@@ -305,7 +306,8 @@ TransporterRegistry::init(NodeId nodeId) {
305
306
}
306
307
307
308
bool
308
- TransporterRegistry::connect_server (NDB_SOCKET_TYPE sockfd) const
309
+ TransporterRegistry::connect_server (NDB_SOCKET_TYPE sockfd,
310
+ BaseString & msg) const
309
311
{
310
312
DBUG_ENTER (" TransporterRegistry::connect_server(sockfd)" );
311
313
@@ -314,6 +316,7 @@ TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
314
316
SocketInputStream s_input (sockfd);
315
317
char buf[11 +1 +11 +1 ]; // <int> <int>
316
318
if (s_input.gets (buf, sizeof (buf)) == 0 ) {
319
+ msg.assfmt (" line: %u : Failed to get nodeid from client" , __LINE__);
317
320
DBUG_PRINT (" error" , (" Failed to read 'hello' from client" ));
318
321
DBUG_RETURN (false );
319
322
}
@@ -328,6 +331,7 @@ TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
328
331
// ok, but with no checks on transporter configuration compatability
329
332
break ;
330
333
default :
334
+ msg.assfmt (" line: %u : Incorrect reply from client: >%s<" , __LINE__, buf);
331
335
DBUG_PRINT (" error" , (" Failed to parse 'hello' from client, buf: '%.*s'" ,
332
336
(int )sizeof (buf), buf));
333
337
DBUG_RETURN (false );
@@ -341,6 +345,7 @@ TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
341
345
if (nodeId < 0 ||
342
346
nodeId >= (int )maxTransporters)
343
347
{
348
+ msg.assfmt (" line: %u : Incorrect reply from client: >%s<" , __LINE__, buf);
344
349
DBUG_PRINT (" error" , (" Out of range nodeId: %d from client" ,
345
350
nodeId));
346
351
DBUG_RETURN (false );
@@ -350,13 +355,20 @@ TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
350
355
Transporter *t= theTransporters[nodeId];
351
356
if (t == 0 )
352
357
{
358
+ msg.assfmt (" line: %u : Incorrect reply from client: >%s<, node: %u" ,
359
+ __LINE__, buf, nodeId);
353
360
DBUG_PRINT (" error" , (" No transporter available for node id %d" , nodeId));
354
361
DBUG_RETURN (false );
355
362
}
356
363
357
364
// Check that the transporter should be connecting
358
365
if (performStates[nodeId] != TransporterRegistry::CONNECTING)
359
366
{
367
+ msg.assfmt (" line: %u : Incorrect state for node %u state: %s (%u)" ,
368
+ __LINE__, nodeId,
369
+ getPerformStateString (performStates[nodeId]),
370
+ performStates[nodeId]);
371
+
360
372
DBUG_PRINT (" error" , (" Transporter for node id %d in wrong state" ,
361
373
nodeId));
362
374
DBUG_RETURN (false );
@@ -376,15 +388,21 @@ TransporterRegistry::connect_server(NDB_SOCKET_TYPE sockfd) const
376
388
SocketOutputStream s_output (sockfd);
377
389
if (s_output.println (" %d %d" , t->getLocalNodeId (), t->m_type ) < 0 )
378
390
{
391
+ msg.assfmt (" line: %u : Failed to reply to connecting socket (node: %u)" ,
392
+ __LINE__, nodeId);
379
393
DBUG_PRINT (" error" , (" Send of reply failed" ));
380
394
DBUG_RETURN (false );
381
395
}
382
396
383
397
// Setup transporter (transporter responsible for closing sockfd)
384
- bool res = t->connect_server (sockfd);
398
+ bool res = t->connect_server (sockfd, msg );
385
399
386
400
if (res && performStates[nodeId] != TransporterRegistry::CONNECTING)
387
401
{
402
+ msg.assfmt (" line: %u : Incorrect state for node %u state: %s (%u)" ,
403
+ __LINE__, nodeId,
404
+ getPerformStateString (performStates[nodeId]),
405
+ performStates[nodeId]);
388
406
// Connection suceeded, but not connecting anymore, return
389
407
// false to close the connection
390
408
DBUG_RETURN (false );
0 commit comments