Commits

Ivan Vučica committed e40cf1f

Expanded behavior story a bit. Normalized content type names. Enabled creating channel inside session with proper content type, which should be the right way to add channels to a transport that lacks them.

Comments (0)

Files changed (1)

libjingle-p2ponly.cpp

     sessionManager->SignalRequestSignaling.connect(sessionManager, &libjinglep2ponlySessionManager::OnRequestSignaling);
     
     printf(" ==> creating a new session\n");
-    session = sessionManager->CreateSession("Local Session Name", "test-type");
+    session = sessionManager->CreateSession("Local Session Name", "CI_content_type");
     
     printf(" ==> signaling ready");
     sessionManager->OnSignalingReady();
     
     // This is probably the key to getting the whole contraption
     // to work. Investigation should probably continue here.
-    //printf(" ==> creating transport channel\n");
+    
+    // Sep 29th 2011:
+    // Indeed, looking at pseudotcpchannel.cc and the constructor for
+    // PseudoTcpChannel, we can see that a channel must indeed be created
+    // manually. 
+    // So, the story is as follows:
+    // - TunnelSessionClient is registered in Session as a possible handler
+    //   of sessions
+    // - TunnelSessionClient upon getting MSG_CREATE_TUNNEL inter-thread message
+    //   creates a Session. 
+    // - It passes it in MakeTunnelSession() that returns a TunnelSession*
+    //  -> MakeTunnelSession() just calls "new TunnelSession()" 
+    // - TunnelSession, while it was being constructed, built a PseudoTcpChannel
+    // - PseudoTcpChannel in its constructor calls session->CreateChannel()
+    // - TunnelSessionClient registers that new TunnelSession* inside its own
+    //   list of sessions
+    // - TunnelSessionClient ->Initiate()s the TunnelSession
+    //
+    
+    printf(" ==> creating transport channel\n");
     //session->CreateChannel("TC_content_type", "TC_channel_name");
+    session->CreateChannel("CI_content_name", "TC_channel_name");
     
     printf(" ==> initiating our session\n");
     cricket::SessionDescription * sessionDescription = new cricket::SessionDescription(contentInfos);
     cricket::SessionMessage m;
     m.type = cricket::ACTION_SESSION_ACCEPT;
     session->OnIncomingMessage(m);
-
-    delete session;
     
     printf(" ==> NOT running an infinite loop\n");
-    /*while(1)
+    /*
+    while(1)
     {
     
-    }*/
+    }
+     */
+    delete session;
+
 	return 0;
 }