r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Uniserve] Creating Uniserve processes

Graham
6-Mar-2005
[33x2]
I left my smtp service running all night .. about 10 hours .. and 
after the 2190'th spam, I hit the infamous "invalid data type during 
recycle" :(
I'll first try switching to 

>> rebol/version
== 2.5.55.3.1
Graham
8-Mar-2005
[35x2]
Had the service running all day while I was at work .. and had over 
1700 smtp connections, of which the script allowed 6 email thru. 
 No spam.
I'm now going to see if I can implement greylisting .. which is an 
interesting technique for fighting spammers.
Graham
9-Mar-2005
[37x3]
Interesting stuff.  With greylisting, and an enhancement I made to 
the greylisting technique, I have managed to reduce spam.  In 6 hours 
I 6 spam made it through to the spamtrap addresses, whereas I would 
have expected more like 20.  And that is from about 800 smtp connections 
.. or potentially 800 spam being sent to my MX record.
should read .. 6 spam.
And that is with a block period of 10 seconds.  The greylisting paper 
suggests using 1 hour and I'll try that now.
Pekr
9-Mar-2005
[40]
Graham - what is your experience with Uniserve so far? So far so 
good? :-)
Graham
9-Mar-2005
[41x3]
Good.
Needs more documentation on writing modules .. but dockimbel says 
he will hopefully produce those in the next couple of days.
As he says, it's very easy to write a new service for it.
Will
9-Mar-2005
[44]
Pekr: Uniserve is uberkool!! It is my main webserver since january 
2003. Since then it crashed 2-3 times, not sure it was uni or rebol 
8)
Graham
9-Mar-2005
[45]
what version of rebol are u using?
Will
9-Mar-2005
[46]
/core 2.5.8.2.4
Graham
9-Mar-2005
[47x2]
Does that have the new async core in it?
I can't remember all these numbers ... :(
Will
9-Mar-2005
[49]
no 8(
Graham
9-Mar-2005
[50]
I was getting async read errors, and at least one data type recycle 
error before switching to  2.5.55.3.1
DideC
9-Mar-2005
[51]
Uniserve is not usable with recent async Core. It use the "old" async 
port system.
Graham
9-Mar-2005
[52x2]
so, doc said .. but my smtp service appears to be working ...
dunno what this means ...
JaimeVargas
9-Mar-2005
[54]
Graham, can you encap uniserve scripts?
Graham
9-Mar-2005
[55x3]
I don't see any reason why not ...
need to redefine 'launch back to itself again.
it looks for files in the services directory .. need to change that 
as well I guess
JaimeVargas
9-Mar-2005
[58]
Last I checked uniserve uses a directory structure to handle stuff. 
So I wonder if the encaped app needs to replicate this structure.
DideC
9-Mar-2005
[59]
I just encap Uniserve script 2 weeks ago.

Need some tricks to encap the protocols/services, that normally Uniserve 
loads from disk at startup.
JaimeVargas
9-Mar-2005
[60x2]
Thats what I thought?
DideC, Do you mind sharing?
Graham
9-Mar-2005
[62x3]
Didier, do you have an example of your encapped changes ?
I want to add database storage for my smtp service, and since I use 
odbc, I have to encap to distribute ...otherwise users have to purchase 
command
( and, no, I don't know anything about mysql .. )
DideC
9-Mar-2005
[65]
In short.

Protocols and services (or whatever else) are encapped as data in 
a block! (a cache sort-of).

instead of 'do/'load, you have to use 'do-cache/'load-cache in your 
script.


The cache functions are initialize differently either you are encapping 
or doing the script.
Graham
9-Mar-2005
[66]
if you do cgi, then you have to launch a new version of the encapped 
script for each cgi ?
DideC
9-Mar-2005
[67x4]
Here is an example of a starter that can be used for doing the script 
and to encap it :
Rebol [

 title: "example of starter script that act the same with View after 
 encap"
]

#include %/e/rebol/sdk/source/mezz.r
#include %/e/rebol/sdk/source/prot.r
#include %/e/rebol/sdk/source/view.r

;***** This is the function that make the tricks
#include %uniserve/libs/encap-fs.r 
if not value? 'encap-fs [do %uniserve/libs/encap-fs.r]

set-cache [
	%uniserve/uni-engine.r		[#include %uniserve/uni-engine.r]
	%uniserve/libs/headers.r	[#include %uniserve/libs/headers.r]
	%libs/log.r					[#include %uniserve/libs/log.r]
	%uniserve/protocols/HTTP.r	[#include %uniserve/protocols/HTTP.r]
	
	%your-file.r					[#include %path/to/your-file.r]
	;...
]

;***** Start
do-cache %uniserve/uni-engine.r
do-cache %uniserve/libs/headers.r

UniServe-path: %./uniserve/
logger/level: none


;***** You have to load protocols and services before starting Uniserve
do-cache %uniserve/protocols/HTTP.r

;***** Uniserve Initialise
; Require like this to not loading protocols/services from disk
uniserve/boot/no-loop/with []

;***** Your script initialise
;...
This is a strip down of the script I use for encaping lecture-forum.
I can also doing it with View.
Graham
9-Mar-2005
[71]
where's the encapped version of lecture-forum?
DideC
9-Mar-2005
[72]
Nowhere actually. Just on my disk.
Graham
9-Mar-2005
[73]
o :)
JaimeVargas
9-Mar-2005
[74]
Does encap-fs defines do-cache and set-cache?
DideC
9-Mar-2005
[75x4]
Yes, very short funcs...
encap-fs: context [
	cache: path: none
	root: system/script/path

	get-cache: func [file][
		path: parse file "/"	
		remove-each dir path [dir = ".."]
		file: to-file path	
		either file [
			either file: select cache file [file][load file]			
		][
			make error! join "Cannot access : " file
		]
	]
	
	set 'encap? to-logic select system/components 'decap

	either encap? [
		set 'set-cache func [list [block!] /local bin file][
			cache: list
			;cache: make block! 16
			;parse list [
			;	some [
			;		(bin: no) opt ['binary (bin: yes)]
			;		set file file! (
			;			repend cache [
			;				file
			;				either bin [read/binary file][read file]
			;			]
			;		)
			;	]
			;]
		]
		set 'do-cache func [file [file!]][do get-cache file]
		set 'load-cache func [file [file!]][load first get-cache file]
		set 'read-cache func [file [file!]][]
	][
		set-cache: none
		do-cache: :do
		load-cache: :load
		read-cache: :read
	]
]
Oups, forget the "Rebol [ ]" header
... and to remove the comments
Graham
9-Mar-2005
[79]
encap uses old core though ...
DideC
9-Mar-2005
[80]
I use enface 1.2.48.3.1
Graham
9-Mar-2005
[81]
I must try this out tonight :)
DideC
9-Mar-2005
[82]
Bed time here. I let you play with it.
Take care of paths, it's what doom me to trouble.