From: <jh...@cp...> - 2003-05-26 14:34:53
|
Rainer, The problem with your fix is that it creates blocking IO. This will work fine as long as there is only one concurrent connection to the ASSP server but will interfere with multiple connections. If Dino's server only connects with one socket at a time it can still work for him. But if an incoming connection coincides with a large delivery it will break. John ----Original Message----- >From: Rainer <ass...@ra...> >To: <ass...@li...> >Cc: >Subj: [Assp-user] FIXED: Problem with Attachments >Reply To: ass...@li... >Sent: Saturday, May 24, 2003 3:25 AM > > >Hi Dino, hi John, > >I'm not sure how dirty this fix is... but it actually works well on my system(s) even in your (Dino) configuration and >with an 30 KBit/sec uplink (simulated, actually I have 256 TeraBit/sec upstream ;-) ). > >What do you have to change? > >replace the subroutine sendqueue (subroutines start with "sub [NAME] {" and end wit "}" on the very first column) in >assp.pl with the following one: > ># sendque enques a string for a socket >sub sendque { > my ($fh,$message)=@_; > my $l=length($message); > print DEBUG "sq: $fh l=$l\n" if $DEBUG;#'$message'\n"; > return unless $fh && $Con{$fh}; > $writable->add($fh); > my $BufferUsed=length($Con{$fh}->{outgoing}); ## rsc > if ($BufSize) { ## rsc > while ($BufferUsed > $BufSize) { ## rsc ># mlog(0,"SendBuffer full ($BufferUsed), sending first"); ## rsc > print DEBUG "SendBuffer ($BufferUsed), sending first\n" if $DEBUG; ## rsc > my $written=syswrite($fh,$Con{$fh}->{outgoing},102400); ## rsc > if($DEBUG) { ## rsc > if($written < 200) { ## rsc > print DEBUG "wrote: ($written)<",substr($Con{$fh}->{outgoing},$written),">\n"; ## rsc > } else { ## rsc > print DEBUG "wrote: ($written)<toolong>\n"; ## rsc > } ## rsc > } ## rsc > $Con{$fh}->{outgoing}=substr($Con{$fh}->{outgoing},$written); ## rsc > $BufferUsed=length($Con{$fh}->{outgoing}); ## rsc > } ## rsc > } ## rsc > $Con{$fh}->{outgoing}.=$message; ## rsc >} > > >and add > ># BufSize is the size of ASSPs send/receive buffer: if this amount of data is in the outBuffer ># then data is sent first to the server before new data from client is accepted ># if your ASSP connects over slow uplink to server then you might use BufSize ># $BufSize=0 disables the buffering (i.e. normal function on LAN >$BufSize=10000; > >to your config.pl, I added it below the $MaxFiles=14003; > > >If you remove the "#" before mlog and start assp from command line (/not/ as a service) you see it working. >See my output attached - 5 minutes session. > >HTH, Rainer > > >P.S. >John, > >it might make sense to make a function SendBuf from this codesnippet to have it only once in the assp.pl? > > >> -----Original Message----- >> From: ass...@li... >> [mailto:ass...@li...]On Behalf Of Rainer >> Sent: Saturday, May 24, 2003 8:15 AM >> To: ass...@li... >> Subject: RE: Re-5: [Assp-user] Problem with Attachments >> >> >> >> John, >> >> actually Dino's challenge is his own mail server: >> It is a cheap and easy to implement alternative for small companies that includes email-, fax- and other >> servers in one >> easy to setup/manage unit. >> Unfortunately it has (as all the software of Tobit) some bugs and limitations... >> >> The clients don't use SMTP to transfer mails to the server. So no way to put ASSP between client and server. >> Dino has now >> >> client --(proprietary protocol)--> server --(SMTP over LAN)--> ASSP --SMTP over slow uplink) --> ISPs mailserver. >> >> And Dino is right, after accepting a mail for 'relaying' ASSP retrieves it as fast as possible into some buffer and >> sends it as fast as possible to the server. if these two speeds differ significantly the client will time out waiting >> for the 220 OK - message. >> >> The idea /could/ be to restrict the buffer size of ASSP to 10 k or so to avoid buffering whole 10 megabyte >> mails but at >> maximum 10k-parts of it. >> To be honestly I don't have an idea if and/or how that is possible in Perl. >> >> >> HTH, Rainer >> >> >> >> >> > -----Original Message----- >> > From: ass...@li... >> > [mailto:ass...@li...]On Behalf Of John Hanna >> > Sent: Thursday, May 22, 2003 9:48 PM >> > To: ass...@li... >> > Subject: Re: Re-5: [Assp-user] Problem with Attachments >> > >> > >> > I'm still guessing here, but it seems like Dino's problem is because he has >> > a slow pipe to his smtp host. There's some timing issue that I'm not yet >> > aware of. It doesn't make sense to me yet why this is a problem, but it is a >> > scenerio that I haven't tested it for -- I'm generally assuming that there >> > is a fast connection from assp to the receiving smtp server. >> > >> > I'll add the debug timestamp to 0.2.0 >> > >> > John >> > >> > ----- Original Message ----- >> > From: "Rainer" <ass...@ra...> >> > To: <ass...@li...> >> > Sent: Monday, May 19, 2003 8:47 AM >> > Subject: RE: Re-5: [Assp-user] Problem with Attachments >> > >> > >> > > >> > > Hey Dino, >> > > >> > > Wuppertal is a nice city ... where you /always/ need an umbrella because >> > the trains are raining from heaven... :-P >> > > I'm not from Ratingen (what ever that is) but from Switzerland (wie zur >> > Hoelle kommst Du auf Ratingen?). So not the next >> > > step to visit you :-D. >> > > >> > > Honestly, I'm not John, but I read a few lines of the prog and what it >> > does is: >> > > It caches up to 10.000 characters of your mail (that's about 10KB --> see >> > line 577 of assp.pl) and decides from that if >> > > the mail is spam or not. >> > > If a mail is spam the connection is reset by ASSP, if not the cache >> > (again: max. 10KB) is sent to the mail server and >> > > after that the streams (in and out) are 'switched together' i.e. ASSP >> > doesn't look at the data anymore. >> > > >> > > >> > > At least I'll need your complete logfile. >> > > If you're afraid of giving too much personal details out you can send a >> > mail to yourself with gdiplus.dll (or similar >> > > windows file) as attachment. >> > > Please modify your assp.pl before: >> > > >> > > somewhere around line 83 you find: >> > > eval(q[sub d {print DEBUG "$time <$_[0]>";}]) if $DEBUG; >> > > >> > > replace that with: >> > > eval(q[sub d { >> > > $time=gmtime(); $time=~s/... (...) (..) (........) ..(..)/$2 $1 $4 $3/; >> > > print DEBUG "$time <$_[0]>"; >> > > } >> > > ]) if $DEBUG; >> > > >> > > >> > > >> > > Waiting for your input, >> > > >> > > Rainer >> > > >> > > >> > > P.S. John - that would be good to /always/ have in the DEBUG, so could you >> > add that please to the code? >> > > It just adds date and time to every log entry to help debugging >> > performance issues. >> > > >> > > >> > > >> > > > -----Original Message----- >> > > > From: ass...@li... >> > > > [mailto:ass...@li...]On Behalf Of >> > > > din...@ar... >> > > > Sent: Monday, May 19, 2003 3:39 PM >> > > > To: ass...@li... >> > > > Subject: Re-5: [Assp-user] Problem with Attachments >> > > > >> > > > >> > > > Hi, >> > > > >> > > > > AFAIK ASSP doesn't cache attachments. >> > > > >> > > > no, it (or something else) caches the whole mail. >> > > > >> > > > > Serious troubleshooting requires a logfile from you, so how about >> > setting >> > > > > DEBUG to '1' and providing that? >> > > > >> > > > ok, I've tried it. The whole e-mail including the attachment is in the >> > log-file. >> > > > Maybe PERL caches the data? And maybe there's a parameter in perl to set >> > a buffer >> > > > or something for this. >> > > > >> > > > Any I've found a parameter at my Mailserver: "WatchdogDelay". > <Message truncated after 200 lines> > |