<commit_before>// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutoNetServerImpl.hpp"
#include "at_exit.h"
#include "autowiring.h"
#include "demangle.h"
#include "ObjectTraits.h"
#include "EventRegistry.h"
#include "TypeRegistry.h"
#include <iostream>
#include FUTURE_HEADER

using std::placeholders::_1;
using std::placeholders::_2;
using json11::Json;

AutoNetServerImpl::AutoNetServerImpl(void) :
  m_Port(8000)
{
  // Configure websocketpp
  m_Server.init_asio();
  m_Server.set_access_channels(websocketpp::log::alevel::none);
  m_Server.set_error_channels(websocketpp::log::elevel::warn);

  // HACK: Work-around for AutoNet server shutdown
  // asio listen error: system:48 (Address already in use)
  m_Server.set_reuse_addr(true);

  // Register handlers
  m_Server.set_open_handler(std::bind(&AutoNetServerImpl::OnOpen, this, ::_1));
  m_Server.set_close_handler(std::bind(&AutoNetServerImpl::OnClose, this, ::_1));
  m_Server.set_message_handler(std::bind(&AutoNetServerImpl::OnMessage, this, ::_1, ::_2));

  // Generate list of all types from type registry
  for(auto type = g_pFirstTypeEntry; type; type = type->pFlink)
    if(type->CanInject())
      m_AllTypes[autowiring::demangle(type->ti)] = [type]{ type->Inject(); };

  // Generate list of all events from event registry<commit_msg>Remove websocket address hack, close #87<commit_after>// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutoNetServerImpl.hpp"
#include "at_exit.h"
#include "autowiring.h"
#include "demangle.h"
#include "ObjectTraits.h"
#include "EventRegistry.h"
#include "TypeRegistry.h"
#include <iostream>
#include FUTURE_HEADER

using std::placeholders::_1;
using std::placeholders::_2;
using json11::Json;

AutoNetServerImpl::AutoNetServerImpl(void) :
  m_Port(8000)
{
  // Configure websocketpp
  m_Server.init_asio();
  m_Server.set_access_channels(websocketpp::log::alevel::none);
  m_Server.set_error_channels(websocketpp::log::elevel::none);

  // Register handlers
  m_Server.set_open_handler(std::bind(&AutoNetServerImpl::OnOpen, this, ::_1));
  m_Server.set_close_handler(std::bind(&AutoNetServerImpl::OnClose, this, ::_1));
  m_Server.set_message_handler(std::bind(&AutoNetServerImpl::OnMessage, this, ::_1, ::_2));

  // Generate list of all types from type registry
  for(auto type = g_pFirstTypeEntry; type; type = type->pFlink)
    if(type->CanInject())
      m_AllTypes[autowiring::demangle(type->ti)] = [type]{ type->Inject(); };

  // Generate list of all events from event registry
{'fraction_non_alphanumeric': 0.14634146341463414, 'fraction_numerical': 0.017034456058846303, 'mean_word_length': 6.258426966292135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4102829', 'n_tokens_mistral': 927, 'n_tokens_neox': 892, 'n_words': 181}