mirror of
https://github.com/worldforge/cyphesis
synced 2026-08-13 12:26:04 -04:00
2009-01-31 Al Riddoch <alriddoch@googlemail.com>
* server/CommPythonClient.cpp, server/CommPythonClient.h: Modify the client connection to use the new Python context class.
This commit is contained in:
parent
a878f8de84
commit
26cd16795c
3 changed files with 14 additions and 4 deletions
|
|
@ -21,18 +21,19 @@
|
|||
#include "CommServer.h"
|
||||
#include "HttpCache.h"
|
||||
|
||||
#include "rulesets/Python_API.h"
|
||||
#include "rulesets/PythonContext.h"
|
||||
|
||||
static const bool debug_flag = false;
|
||||
|
||||
CommPythonClient::CommPythonClient(CommServer & svr, int fd) :
|
||||
CommStreamClient(svr, fd)
|
||||
CommStreamClient(svr, fd), m_pyContext(new PythonContext)
|
||||
{
|
||||
m_clientIos.setTimeout(0,1000); // FIXME?
|
||||
}
|
||||
|
||||
CommPythonClient::~CommPythonClient()
|
||||
{
|
||||
delete m_pyContext;
|
||||
}
|
||||
|
||||
void CommPythonClient::dispatch()
|
||||
|
|
@ -54,8 +55,9 @@ int CommPythonClient::read()
|
|||
if (m_incoming.empty()) {
|
||||
std::cout << "[NOT]" << std::endl << std::flush;
|
||||
} else {
|
||||
std::cout << m_incoming << std::endl << std::flush;
|
||||
run_python_command(m_incoming.c_str());
|
||||
// std::cout << m_incoming << std::endl << std::flush;
|
||||
std::cout << "[" << m_pyContext->runCommand(m_incoming)
|
||||
<< "]" << std::endl << std::flush;
|
||||
m_incoming.clear();
|
||||
}
|
||||
} else if (next == '\r') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue