diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2006-06-19 18:22:55 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2006-06-19 18:22:55 +0000 |
| commit | 4df99895b9f97c64966f9c747b1fbb92a980a258 (patch) | |
| tree | f0f568e7875cc40bde9bc5c8f33a757a498de0ac /src/pedro/pedroxmpp.cpp | |
| parent | expanding/contracting node selection by pgup/pgdn (diff) | |
| download | inkscape-4df99895b9f97c64966f9c747b1fbb92a980a258.tar.gz inkscape-4df99895b9f97c64966f9c747b1fbb92a980a258.zip | |
add config
(bzr r1233)
Diffstat (limited to 'src/pedro/pedroxmpp.cpp')
| -rw-r--r-- | src/pedro/pedroxmpp.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/pedro/pedroxmpp.cpp b/src/pedro/pedroxmpp.cpp index 30070c434..48a4930b4 100644 --- a/src/pedro/pedroxmpp.cpp +++ b/src/pedro/pedroxmpp.cpp @@ -27,6 +27,8 @@ #include <sys/stat.h> +#include <time.h> + #include "pedroxmpp.h" #include "pedrodom.h" #include "pedroutil.h" @@ -755,7 +757,7 @@ bool XmppClient::pause(unsigned long millis) static int strIndex(const DOMString &str, char *key) { unsigned int p = str.find(key); - if (p == DOMString::npos) + if (p == str.npos) return -1; return p; } @@ -833,6 +835,7 @@ void XmppClient::setUsername(const DOMString &val) DOMString XmppClient::readStanza() { + int openCount = 0; bool inTag = false; bool slashSeen = false; @@ -842,6 +845,9 @@ DOMString XmppClient::readStanza() bool textSeen = false; DOMString buf; + + time_t timeout = time((time_t *)0) + 180; + while (true) { int ch = sock->read(); @@ -853,6 +859,17 @@ DOMString XmppClient::readStanza() //Since we are timed out, let's assume that we //are between chunks of text. Let's reset all states. //printf("-----#### Timeout\n"); + time_t currentTime = time((time_t *)0); + if (currentTime > timeout) + { + timeout = currentTime + 180; + if (!write("\n")) + { + error("ping send error"); + disconnect(); + return ""; + } + } continue; } else @@ -1472,7 +1489,7 @@ bool XmppClient::receiveAndProcessLoop() { if (!keepGoing) { - printf("Abort requested\n"); + status("Abort requested"); break; } if (!receiveAndProcess()) |
