Thread Daemon::SSL nach Annahme der Verbindung forken (13 answers)
Opened by drux at 2010-06-30 00:37

drux
 2010-07-06 20:32
#139601 #139601
User since
2010-06-30
6 Artikel
BenutzerIn

user image
Also: mit dem HTTP::Daemon scheint es besser zu gehen.
Ich habe 4 Requests gestarten und 3 instanzen bekommen O.o (warum auch immer) jede wartet 10 sek. aber er ist nach ca 30sek erst mit der letzten anfrage durch. sollte das nicht eigentlich nach 10 sekunden der Fall sein, da ja alle 3 zeitgleich ausgefuehrt werden?
Allerdings hab ich auch keine erklaerung warum es mit dem SSL nicht geht :/
Ich poste vollstanedigkeitshalber mal noch den rest des Daemon:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl

use warnings;
use strict;
use HTTP::Daemon;
use POSIX qw(setsid);
use Digest::SHA qw(sha256_hex);
require 'functions.pl' or die $!;

my $d = HTTP::Daemon->new(LocalAddr => "localhost", LocalPort => 8080, ReuseAddr => 1) || die "Couldn't start server! Reason: $!";
print "Serving as (".$$.") on ".$d->sockhost.":".$d->sockport."\n";
#
# catching the exit- or termination status of the child process to avoid zombies 
#
$SIG{CHLD} = sub {wait ()};
#
# daemonizing, In- and Output to /dev/null and forking the server => giving control back to the shell
#
#&daemonize;
#
# looping and forking a child to process the incoming request that was accepted by the main program
#

while ( 1 ) {# prevents from exiting when client connects without SSL 
        while (my $c = $d->accept()) {
                my $pid = fork();
            die "Cannot fork: $!" unless defined($pid);
                if ($pid == 0) { 
                        #&handle($c);
                        sleep(10);
                        exit(0);
                }
        }    
}
close($d);

Last edited: 2010-07-06 20:34:21 +0200 (CEST)
Guck mal wer da kommt! Der Wayne-Train!

View full thread Daemon::SSL nach Annahme der Verbindung forken