func (i *Dispatcher) setupNewConnection(flow *types.TcpIpFlow) ConnectionInterface { options := ConnectionOptions{ MaxBufferedPagesTotal: i.options.BufferedTotal, MaxBufferedPagesPerConnection: i.options.BufferedPerConnection, MaxRingPackets: i.options.MaxRingPackets, PageCache: i.pageCache, LogDir: i.options.LogDir, AttackLogger: i.options.Logger, LogPackets: i.options.LogPackets, DetectHijack: i.options.DetectHijack, DetectInjection: i.options.DetectInjection, DetectCoalesceInjection: i.options.DetectCoalesceInjection, Pool: &i.pool, } conn := i.connectionFactory.Build(options) if i.options.LogPackets { packetLogger := i.PacketLoggerFactory.Build(flow) conn.SetPacketLogger(packetLogger) packetLogger.Start() } i.pool[flow.ConnectionHash()] = conn if i.observeConnectionCount != 0 && i.observeConnectionCount == len(i.connections()) { i.observeConnectionChan <- true } return conn }