File size: 770 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// -*- mode: c++; indent-tabs-mode: nil; tab-width: -*-
#include "CloseSession.h"
#include "TranslationRequest.h"
#include "Server.h"

namespace MosesServer
{
  CloseSession::
  CloseSession(Server& server)
    : m_server(server) 
  { }
  
  void 
  CloseSession::
  execute(xmlrpc_c::paramList const& paramList,
	  xmlrpc_c::value *   const  retvalP)
  {
    typedef std::map<std::string, xmlrpc_c::value> params_t;
    paramList.verifyEnd(1); // ??? UG
    params_t const& params = paramList.getStruct(0);
    params_t::const_iterator si = params.find("session-id");
    if (si != params.end())
      {
	uint64_t session_id = xmlrpc_c::value_int(si->second);
	m_server.delete_session(session_id);
	*retvalP = xmlrpc_c::value_string("Session closed");
      }
  }
  
}