From 5c102fdd1e6825a77bb9d7a69e268868d7f5398e Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 19 Aug 2008 09:28:09 +0000 Subject: Bugfix. Shared connection didn't work with the continue action. --- client/macrowindow.cc | 12 +++++-- client/netcom.cc | 3 ++ server/configure.in | 86 --------------------------------------------------- server/src/server.cc | 5 +-- 4 files changed, 15 insertions(+), 91 deletions(-) diff --git a/client/macrowindow.cc b/client/macrowindow.cc index e3d4846..abd615c 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -128,8 +128,6 @@ bool MacroWindow::doCommit() // If all entries passed validation, continue commit if(faulty == 0) { - printf("MacroWindow -> committing...\n"); - Global::netcom->send(widgets, macro, version); return true; @@ -182,7 +180,15 @@ void MacroWindow::cont(QString name) i++; } if(doCommit()) { - new_macro("FIXME", macro); + + // FIXME: Hack to prevent XML clotching. + // The server could not differentiate the commit and the request. + delete Global::netcom; + Global::netcom = new NetCom(host, port, user, cpr); + + + // TODO: Where to get the course var?? + new_macro("example", macro); close(); } else { QMessageBox::critical(NULL, "Fejl", diff --git a/client/netcom.cc b/client/netcom.cc index 0f73e60..060517d 100644 --- a/client/netcom.cc +++ b/client/netcom.cc @@ -58,7 +58,10 @@ QDomDocument NetCom::send(QString course, QString macro) request_elem.setAttribute("macro", macro); pracro_elem.appendChild(request_elem); + printf(doc.toString().toStdString().c_str()); + socket.write(doc.toByteArray()); + socket.waitForBytesWritten(10000); do { qApp->processEvents(); diff --git a/server/configure.in b/server/configure.in index a5af2c1..013ea9a 100644 --- a/server/configure.in +++ b/server/configure.in @@ -135,98 +135,12 @@ AC_CHECK_HEADER(expat.h, , AC_MSG_ERROR([*** eXpat header file not found!])) AC_CHECK_LIB(expat, XML_ParserCreate, , AC_MSG_ERROR([*** eXpat library not found!])) -#dnl ====================== -#dnl Check for xerces-x -#dnl ====================== -#AC_ARG_WITH(xercescinc, -# [ --with-xercescinc Set the incude dir for xerces], -# [if test -n ${with_xercescinc}; then -# xercesc_inc=${with_xercescinc}; -# dcheck="$dcheck --with-xercescinc=${with_xercescinc} "; -# else -# xercesc_inc=${oldincludedir}/xercesc; -# fi -# ], -# [xercesc_inc=${oldincludedir}/xercesc;] -#) -#AC_ARG_WITH(xercesclib, -# [ --with-xercesclib Set the lib dir for xerces], -# [if test -n ${with_xercesclib}; then -# xercesc_lib=${with_xercesclib}; -# dcheck="$dcheck --with-xercesclib=${with_xercesclib} " -# else -# xercesc_lib=${libdir}; -# fi -# ], -# [xercesc_lib=${libdir};] -#) -#CXXFLAGS="${CXXFLAGS} -I${xercesc_inc}" -#LIBS="${LIBS} -L${xercesc_lib} -lxerces-c" -#AC_SUBST(CXXFLAGS) -#AC_SUBST(LIBS) -#AC_CHECK_HEADER(xercesc/util/XercesVersion.hpp, , -# AC_MSG_ERROR([*** libxerces-c headers not found!])) -#AC_CHECK_LIB(xerces-c, main, , AC_MSG_ERROR([*** libxerces-c not found!])) - AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(LDFLAGS) - - -# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/ -# ---------------------------------------------------------------------------- -AC_DEFUN([BB_ENABLE_DOXYGEN], -[ -AC_ARG_ENABLE(doxygen, - [ --enable-doxygen enable documentation generation with doxygen (auto)]) -AC_ARG_ENABLE(dot, - [ --enable-dot use 'dot' to generate graphs in doxygen (auto)]) -AC_ARG_ENABLE(html-docs, - [ --enable-html-docs enable HTML generation with doxygen (no)], - [], [ enable_html_docs=no]) -AC_ARG_ENABLE(latex-docs, - [ --enable-latex-docs enable LaTeX documentation generation with doxygen (no)], - [], [ enable_latex_docs=no]) -if test "x$enable_doxygen" = xno; then - enable_doc=no -else - AC_OUTPUT(doc/Makefile) - DOC_DIR=doc - AC_SUBST(DOC_DIR) - AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) - if test x$DOXYGEN = x; then - if test "x$enable_doxygen" = xyes; then - AC_MSG_ERROR([could not find doxygen]) - fi - enable_doc=no - else - enable_doc=yes - AC_PATH_PROG(DOT, dot, , $PATH) - fi -fi -AM_CONDITIONAL(DOC, test x$enable_doc = xyes) - -if test x$DOT = x; then - if test "x$enable_dot" = xyes; then - AC_MSG_ERROR([could not find dot]) - fi - enable_dot=no -else - enable_dot=yes -fi -AM_CONDITIONAL(ENABLE_DOXYGEN, test x$enable_doc = xtrue) -AC_SUBST(enable_dot) -AC_SUBST(enable_html_docs) -AC_SUBST(enable_latex_docs) -]) - -# check for doxygen -# ---------------------------------------------------------------------------- -BB_ENABLE_DOXYGEN - AC_OUTPUT( Makefile src/Makefile diff --git a/server/src/server.cc b/server/src/server.cc index d2921b8..96c5006 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -216,9 +216,9 @@ static std::string handleTransaction(Transaction &transaction) static void handleConnection(TCPSocket *socket) { - size_t bufsize = 256; + size_t bufsize = 4096; int size; - char buf[256]; + char buf[bufsize]; memset(buf, 0, bufsize); Transaction *transaction = NULL; @@ -233,6 +233,7 @@ static void handleConnection(TCPSocket *socket) printf("Got %d bytes in read loop\n", size); if(parser->parse(buf)) { + printf("Got complete XML document\n"); socket->write(handleTransaction(*transaction)); delete transaction; -- cgit v1.2.3