Title: Re: Help with flamethrowerd
Hey Brian:
 
I can check the code into trunk, but I think my focus right now would be to get this running with SystemImager, so I don't know if I will have time to test to see if the transport works with standalone flamethrower...  is that going to be a problem?
 
Regarding my issue, it appears to be caused by the fact that I have a bunch of system() calls within maketorrent() - I don't think that plays well with fork/cast...  I'll have to look deeper into the code - if you have any suggestions, please let me know.
 
Thanks,
 
Bernard


From: Brian Elliott Finley on behalf of Brian Elliott Finley
Sent: Sat 31/12/2005 11:19
To: Bernard Li
Subject: Re: Help with flamethrowerd

Go ahead and check your code into the flamethrower trunk.

I'm betting that what you're getting stuck on is a perl fork related concept.

I've attached a very simple forking perl daemon as an example.

Again, please send these to the -devel list too.  Others may have good
feedback on things like this also.

Cheers, -Brian



Thus spake Bernard Li ([EMAIL PROTECTED]):
>Hi Brian:
>
>I'm integrating the BitTorrent transport into Flamethrower and could use your help explaining the cast() subrountine in flamethrowerd.
>
>Instead of running "build_udp_sender_cmd", I created a new subrountine called "build_bittorrent_cmd" which calls the bittorrent-console command.  This command is used to seed the torrent and is expected to be started when flamethrowerd is started and not stopped until flamethrowerd is stopped.
>
>I have added a call to subroutine maketorrent() which creates the torrent inside the cast subroutine which is called prior to build_bittorrent_cmd().
>
>Here's the code snippet from cast():
>
>    # Make torrent if using the BitTorrent transport
>    if ($transport eq "bittorrent") {
>        maketorrent($module);
>    }
>    # Fork and cast
>    if ($parent_pid = fork) {
>        record_pid($parent_file, $parent_pid);
>    } elsif (defined $parent_pid) { # send the forked child off
>        setsid or die "Can't start a new session: $!";
>        print "casting $module\n" if($debug);
>        my $cmd = "";
>        if ($transport eq "bittorrent") {
>            $cmd = build_bittorrent_cmd($module);
>        } else {
>            $cmd = build_udp_sender_cmd($module);
>        }
>
>It basically loops through each module, making the torrent and seeding it, however, it gets stuck in the middle until I kill the process of the previous module (the pid is recorded in /var/state/systemimager/flamethrower).
>
>Perhaps if I understand the cast() subroutine better, then I will be able to figure this out.
>
>Thanks,
>
>Bernard

--
Brian Elliott Finley
Mobile:  630.631.6621

Reply via email to