summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-08-06 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-08-06 18:00:00 +0200
commit33f1491b18c201ecda4ff2c34f606d9f5f041489 (patch)
tree32f49da0229fb93b1e0ceb92aa099d16f1562751 /svdrp.c
parent80c04529681b844de88cfa47ec743f847b37d7a2 (diff)
downloadvdr-patch-lnbsharing-33f1491b18c201ecda4ff2c34f606d9f5f041489.tar.gz
vdr-patch-lnbsharing-33f1491b18c201ecda4ff2c34f606d9f5f041489.tar.bz2
Version 1.4.1-3vdr-1.4.1-3
- Fixed assigning schedules to channels in case there is no initial EPG information (thanks to Frank Schmirler). - Increased the APIVERSION to allow plugins that relied on the cStatus::MsgSetVolume() bug to react properly (suggested by Stefan Huelswitt). - Fixed cDevice::ToggleMute() (thanks to Christoph Haubrich). - Fixed deleting the last character of a string menu item in insert mode (thanks to Udo Richter). - The /video/.update file is now touched _after_ an editing process is finished in order to avoid excessive disk access (thanks to Artur Skawina). - Fixed handling the running status of EPG events before the currently running one, in case they are added after the current event (cont'd from version 1.4.1-2). - Modified the shutdown mechanism, so that the shutdown script is never given a time in the past (reported by Helmut Auer). If a timer is currently recording, or a recording would start within the next 30 minutes (default for the "Min. event timeout" setup parameter), and the user insists in shutting down now, the reboot time given to the shutdown script will correspond to a time that is "Min. event timeout" minutes (default is 30) in the future. - Avoiding shutdown message "Recording in ... minutes, shut down anyway?" with a negative number of minutes (reported by Udo Richter). - Fixed getting the next active timer when shutting down (thanks to Udo Richter). - Modified the cSVDRP::Close() function to avoid code duplication.
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/svdrp.c b/svdrp.c
index 6972681..b231752 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.98 2006/07/22 13:59:43 kls Exp $
+ * $Id: svdrp.c 1.99 2006/08/06 09:17:58 kls Exp $
*/
#include "svdrp.h"
@@ -378,17 +378,19 @@ cSVDRP::cSVDRP(int Port)
cSVDRP::~cSVDRP()
{
- Close();
+ Close(true);
free(cmdLine);
}
-void cSVDRP::Close(bool Timeout)
+void cSVDRP::Close(bool SendReply, bool Timeout)
{
if (file.IsOpen()) {
- //TODO how can we get the *full* hostname?
- char buffer[BUFSIZ];
- gethostname(buffer, sizeof(buffer));
- Reply(221, "%s closing connection%s", buffer, Timeout ? " (timeout)" : "");
+ if (SendReply) {
+ //TODO how can we get the *full* hostname?
+ char buffer[BUFSIZ];
+ gethostname(buffer, sizeof(buffer));
+ Reply(221, "%s closing connection%s", buffer, Timeout ? " (timeout)" : "");
+ }
isyslog("closing SVDRP connection"); //TODO store IP#???
file.Close();
DELETENULL(PUTEhandler);
@@ -401,7 +403,7 @@ bool cSVDRP::Send(const char *s, int length)
length = strlen(s);
if (safe_write(file, s, length) < 0) {
LOG_ERROR;
- file.Close();
+ Close();
return false;
}
return true;
@@ -423,10 +425,8 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
cont = '-';
char number[16];
sprintf(number, "%03d%c", abs(Code), cont);
- if (!(Send(number) && Send(s, n ? n - s : -1) && Send("\r\n"))) {
- Close();
+ if (!(Send(number) && Send(s, n ? n - s : -1) && Send("\r\n")))
break;
- }
s = n ? n + 1 : NULL;
}
free(buffer);
@@ -1530,7 +1530,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("STAT")) CmdSTAT(s);
else if (CMD("UPDT")) CmdUPDT(s);
else if (CMD("VOLU")) CmdVOLU(s);
- else if (CMD("QUIT")) Close();
+ else if (CMD("QUIT")) Close(true);
else Reply(500, "Command unrecognized: \"%s\"", Cmd);
}
@@ -1570,7 +1570,7 @@ bool cSVDRP::Process(void)
}
else if (c == 0x04 && numChars == 0) {
// end of file (only at beginning of line)
- Close();
+ Close(true);
}
else if (c == 0x08 || c == 0x7F) {
// backspace or delete (last character)
@@ -1590,20 +1590,14 @@ bool cSVDRP::Process(void)
}
lastActivity = time(NULL);
}
- else if (r < 0) {
+ else if (r <= 0) {
isyslog("lost connection to SVDRP client");
Close();
}
- else {
- isyslog("SVDRP client closed connection");
- //TODO give cSVDRP::Close() an extra parameter to avoid this code duplication
- file.Close();
- DELETENULL(PUTEhandler);
- }
}
if (Setup.SVDRPTimeout && time(NULL) - lastActivity > Setup.SVDRPTimeout) {
isyslog("timeout on SVDRP connection");
- Close(true);
+ Close(true, true);
}
return true;
}