'use strict';


const { EngineStartupError } = require('../error');
const { setLogger } = require('../utilities');
const { processOptions } = require('../options');
const { httpStartServer } = require('./http');


/**
 * Start server for each protocol, for the moment only HTTP
 *
 * @param {object} options
 * @param {object} options.idl - IDL definitions
 */
const startServer = async function (options) {
  try {
    const opts = await processOptions(options);

    if (opts.logger) {
      setLogger({ logger: opts.logger });
    }

    const server = await Promise.all([
      httpStartServer(opts),
    ]);
    return server;
  // Make sure all exceptions thrown at startup follow
  // the EngineStartupError signature
  } catch (innererror) {
    if (innererror instanceof EngineStartupError) {
      throw innererror;
    } else {
      throw new EngineStartupError(innererror.message, {
        reason: 'UNKNOWN',
        innererror,
      });
    }
  }
};


module.exports = {
  startServer,
};

@@ -538,20 +538,89 @@
     
-const server
+// Make sure all servers are starting concurrently, not serially%0A    const %5Bhttp%5D
  = a
@@ -675,16 +675,46 @@
     %5D);%0A
+    const servers = %7B http %7D;%0A
     retu
@@ -722,16 +722,17 @@
 n server
+s
 ;%0A  // M

Return servers as a map not an array