Title: Re: Help with flamethrowerd
Okay I figured it out, I moved the maketorrent() call to within the elsif clause:
 
} elsif (defined $parent_pid) { # send the forked child off
 
then it worked.
 
The only remaining issue with this, is that after you start flamethrowerd, it actually takes a while for everything to be "ready" (it takes time to tar up the image directory and subsequently create the torrent file).  So I suppose we have to do something like:
 
Starting Flamethrower daemon: flamethrowerd ............................................................ ok
 
But it'll be a long wait...
 
Any other suggestions?
 
Cheers,
 
Bernard


From: [EMAIL PROTECTED] on behalf of Bernard Li
Sent: Sat 31/12/2005 16:25
To: Brian Elliott Finley
Cc: sisuite-devel@lists.sourceforge.net
Subject: [Sisuite-devel] RE: Help with flamethrowerd

Hey Brian:
 
I'll need to clean up the code before I check it in.  In the mean time, if you can take a look at the following patch and tell me what I did wrong, I'd appreciate it.
 
Is there a flamethrower-commit mailing-list somewhere I can subscribe to?
 
For flamethrower.conf - I was thinking of separating the BitTorrent specific configuration options - i.e. prefixing it with "BT".  Eg. you can specify the maximum bitrate (similar to MAX_BITRATE = 20M) and the option will be called "BT_MAX_UPLOAD_RATE".  At first I thought I could share the same option but for BitTorrent, --max_upload_rate 0 means unlimited but with AppConfig that is translated as "off".  Also, BitTorrent expects the argument to be numerical number only, so "20M" won't work.
 
Thanks,
 
Bernard


From: Brian Elliott Finley on behalf of Brian Elliott Finley
Sent: Sat 31/12/2005 15:15
To: Bernard Li
Cc: sisuite-devel@lists.sourceforge.net
Subject: Re: Help with flamethrowerd

Thus spake Bernard Li ([EMAIL PROTECTED]):
>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?

Not initially.  I don't anticipate doing a release from the flamethrower
trunk anytime soon, so I'm not too worried about it.

Also, I would expect that your BT mods to flamethrower are feature
additions, and should not break existing functionality, even during
development.  But even if it does, go ahead and use trunk for the
flamethrower stuff in this case.


>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.

Will take a look after you check it in.

Cheers, -Brian


>
>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
>
>

--
Brian Elliott Finley
Mobile:  630.631.6621

Reply via email to