Make tcp active open data structures thread safe

- Cleanup half-open connections and timers on the right thread
- Ensure half-open connection and transport endpoint pools are thread safe
- Enqueue TX events to the correct vpp thread in the builtin client
- Use transport proto in transport connections instead of session type

Change-Id: Id13239a206afbff6f34a38afa510fe014e4b2049
Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/src/vnet/tcp/builtin_client.h b/src/vnet/tcp/builtin_client.h
index 38af231..06d239e 100644
--- a/src/vnet/tcp/builtin_client.h
+++ b/src/vnet/tcp/builtin_client.h
@@ -48,8 +48,7 @@
    * Application setup parameters
    */
   unix_shared_memory_queue_t *vl_input_queue;	/**< vpe input queue */
-  unix_shared_memory_queue_t *our_event_queue;	/**< Our event queue */
-  unix_shared_memory_queue_t *vpp_event_queue;	/**< $$$ single thread */
+  unix_shared_memory_queue_t **vpp_event_queue;
 
   u32 cli_node_index;			/**< cli process node index */
   u32 my_client_index;			/**< loopback API client handle */
@@ -70,9 +69,9 @@
   /*
    * Test state variables
    */
-  session_t *sessions;			/**< Sessions pool */
-  u8 *rx_buf;				/**< intermediate rx buffer */
-  uword *session_index_by_vpp_handles;	/**< Hash table for disconnecting */
+  session_t *sessions;			/**< Session pool, shared */
+  clib_spinlock_t sessions_lock;
+  u8 **rx_buf;				/**< intermediate rx buffers */
   u8 *connect_test_data;		/**< Pre-computed test data */
   u32 **connection_index_by_thread;
   u32 **connections_this_batch_by_thread; /**< active connection batch */