diff options
author | lordjaxom <lordjaxom> | 2005-02-08 13:59:16 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2005-02-08 13:59:16 +0000 |
commit | 8e4556b0a982dab75d8ba3bb388965ecf47fa0b0 (patch) | |
tree | cda6583f76af5967c634fffe454b003052baf521 /client/socket.c | |
parent | 04a5985dcc0a24a1ff7b8debd5e88d4de46bb989 (diff) | |
download | vdr-plugin-streamdev-8e4556b0a982dab75d8ba3bb388965ecf47fa0b0.tar.gz vdr-plugin-streamdev-8e4556b0a982dab75d8ba3bb388965ecf47fa0b0.tar.bz2 |
- first adoptions (transfer-commit)
Diffstat (limited to 'client/socket.c')
-rw-r--r-- | client/socket.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/client/socket.c b/client/socket.c index 44af8db..9e399cb 100644 --- a/client/socket.c +++ b/client/socket.c @@ -1,5 +1,5 @@ /* - * $Id: socket.c,v 1.1 2004/12/30 22:44:04 lordjaxom Exp $ + * $Id: socket.c,v 1.2 2005/02/08 13:59:16 lordjaxom Exp $ */ #include <tools/select.h> @@ -39,15 +39,12 @@ cTBSocket *cClientSocket::DataSocket(eSocketId Id) const { bool cClientSocket::Command(const cTBString &Command, uint Expected, uint TimeoutMs) { - cTBString pkt; - time_t st; - errno = 0; - pkt = Command + "\015\012"; + cTBString pkt = Command + "\015\012"; Dprintf("OUT: |%s|\n", (const char*)Command); - st = time_ms(); + cTimeMs starttime; if (!TimedWrite((const char*)pkt, pkt.Length(), TimeoutMs)) { esyslog("Streamdev: Lost connection to %s:%d: %s", (const char*)RemoteIp(), RemotePort(), strerror(errno)); @@ -55,8 +52,9 @@ bool cClientSocket::Command(const cTBString &Command, uint Expected, return false; } - if (Expected != 0) { - TimeoutMs -= time_ms() - st; + uint64 elapsed = starttime.Elapsed(); + if (Expected != 0) { // XXX+ What if elapsed > TimeoutMs? + TimeoutMs -= elapsed; return Expect(Expected, NULL, TimeoutMs); } |