picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 5be7cfde7d2db99576bddd52e1ae371a124363f3
parent dd9b1effa48936b7af31e69c440d8f0de0772a3f
Author: Alexander Burger <abu@software-lab.de>
Date:   Sun,  4 Aug 2013 08:59:51 +0200

'ssl' timeout
Diffstat:
MCHANGES | 1+
Mbin/replica | 6+++---
Msrc/ssl.c | 6+++++-
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * DDsep13 picoLisp-3.1.4 + 'ssl' timeout 'casq' flow function Pilog Lisp call syntax with '^' 'read' preserves trailing white space diff --git a/bin/replica b/bin/replica @@ -1,5 +1,5 @@ #!bin/picolisp lib.l -# 06may11abu +# 03aug13abu # Use: bin/replica <port> <keyFile> <journal> <dbFile> <blob/app/> [dbs1 ..] # : bin/ssl <host> 443 '<port>/!replica' <keyFile> <journal> <blob/app/> 60 @@ -19,11 +19,11 @@ (when (= (line T) *SSLKey) (let? X (line T) (if (format X) - (when (out (tmp 'replica) (echo @)) # Journal + (when (abort 420 (out (tmp 'replica) (echo @))) # Journal (prin (peek)) (flush) (journal (tmp 'replica)) ) - (let Blob (pack *Blob X) # Blob + (let Blob (pack *Blob X) # Blob (call 'mkdir "-p" (dirname Blob)) (out Blob (echo)) ) ) ) ) ) ) ) diff --git a/src/ssl.c b/src/ssl.c @@ -1,4 +1,4 @@ -/* 04feb13abu +/* 03aug13abu * (c) Software Lab. Alexander Burger */ @@ -173,6 +173,7 @@ int main(int ac, char *av[]) { signal(SIGINT, doSigTerm); signal(SIGTERM, doSigTerm); signal(SIGPIPE, SIG_IGN); + signal(SIGALRM, SIG_IGN); for (;;) { if (*File && (fd = open(File, O_RDWR)) >= 0) { if (fstat(fd,&st) < 0 || st.st_size == 0) @@ -196,15 +197,18 @@ int main(int ac, char *av[]) { close(fd); for (;;) { if ((sd = sslConnect(ssl, av[1], av[2])) >= 0) { + alarm(420); if (SSL_write(ssl, get, getLen) == getLen && (!*av[4] || sslFile(ssl,av[4])) && // key (bin || SSL_write(ssl, len, lenLen) == lenLen) && // length SSL_write(ssl, Data, Size) == Size && // data SSL_write(ssl, bin? "\0" : "T", 1) == 1 && // ack SSL_read(ssl, buf, 1) == 1 && buf[0] == 'T' ) { + alarm(0); sslClose(ssl,sd); break; } + alarm(0); sslClose(ssl,sd); } sleep(sec);