@@ -1236,10 +1236,9 @@ SharedBuffer<u8> UDPPeer::addSpiltPacket(u8 channel,
1236
1236
/* Connection Threads */
1237
1237
/* *****************************************************************************/
1238
1238
1239
- ConnectionSendThread::ConnectionSendThread (Connection* parent,
1240
- unsigned int max_packet_size,
1239
+ ConnectionSendThread::ConnectionSendThread ( unsigned int max_packet_size,
1241
1240
float timeout) :
1242
- m_connection (parent ),
1241
+ m_connection (NULL ),
1243
1242
m_max_packet_size (max_packet_size),
1244
1243
m_timeout (timeout),
1245
1244
m_max_commands_per_iteration (1 ),
@@ -1250,6 +1249,7 @@ ConnectionSendThread::ConnectionSendThread(Connection* parent,
1250
1249
1251
1250
void * ConnectionSendThread::Thread ()
1252
1251
{
1252
+ assert (m_connection != NULL );
1253
1253
ThreadStarted ();
1254
1254
log_register_thread (" ConnectionSend" );
1255
1255
@@ -1995,14 +1995,14 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
1995
1995
m_outgoing_queue.push_back (packet);
1996
1996
}
1997
1997
1998
- ConnectionReceiveThread::ConnectionReceiveThread (Connection* parent,
1999
- unsigned int max_packet_size) :
2000
- m_connection(parent)
1998
+ ConnectionReceiveThread::ConnectionReceiveThread (unsigned int max_packet_size) :
1999
+ m_connection(NULL )
2001
2000
{
2002
2001
}
2003
2002
2004
2003
void * ConnectionReceiveThread::Thread ()
2005
2004
{
2005
+ assert (m_connection != NULL );
2006
2006
ThreadStarted ();
2007
2007
log_register_thread (" ConnectionReceive" );
2008
2008
@@ -2657,8 +2657,8 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
2657
2657
m_event_queue(),
2658
2658
m_peer_id(0 ),
2659
2659
m_protocol_id(protocol_id),
2660
- m_sendThread(this , max_packet_size, timeout),
2661
- m_receiveThread(this , max_packet_size),
2660
+ m_sendThread(max_packet_size, timeout),
2661
+ m_receiveThread(max_packet_size),
2662
2662
m_info_mutex(),
2663
2663
m_bc_peerhandler(0 ),
2664
2664
m_bc_receive_timeout(0 ),
@@ -2667,6 +2667,9 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
2667
2667
{
2668
2668
m_udpSocket.setTimeoutMs (5 );
2669
2669
2670
+ m_sendThread.setParent (this );
2671
+ m_receiveThread.setParent (this );
2672
+
2670
2673
m_sendThread.Start ();
2671
2674
m_receiveThread.Start ();
2672
2675
}
@@ -2678,8 +2681,8 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
2678
2681
m_event_queue(),
2679
2682
m_peer_id(0 ),
2680
2683
m_protocol_id(protocol_id),
2681
- m_sendThread(this , max_packet_size, timeout),
2682
- m_receiveThread(this , max_packet_size),
2684
+ m_sendThread(max_packet_size, timeout),
2685
+ m_receiveThread(max_packet_size),
2683
2686
m_info_mutex(),
2684
2687
m_bc_peerhandler(peerhandler),
2685
2688
m_bc_receive_timeout(0 ),
@@ -2689,6 +2692,9 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
2689
2692
{
2690
2693
m_udpSocket.setTimeoutMs (5 );
2691
2694
2695
+ m_sendThread.setParent (this );
2696
+ m_receiveThread.setParent (this );
2697
+
2692
2698
m_sendThread.Start ();
2693
2699
m_receiveThread.Start ();
2694
2700
0 commit comments