IN: concurrency.distributed.tests
USING: tools.test concurrency.distributed kernel io.files
arrays io.sockets system combinators threads math sequences
-concurrency.messaging continuations ;
+concurrency.messaging continuations accessors prettyprint ;
-: test-node
+: test-node ( -- addrspec )
{
{ [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
{ [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] }
[ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
-[ ] [ test-node dup 1array swap (start-node) ] unit-test
+[ ] [ test-node dup (start-node) ] unit-test
-[ ] [ 100 sleep ] unit-test
+[ ] [ 1000 sleep ] unit-test
[ ] [
[
receive
] unit-test
+[ ] [ 1000 sleep ] unit-test
+
[ ] [ test-node stop-node ] unit-test
binary >>encoding
"concurrency.distributed" >>name
[ handle-node-client ] >>handler
+ start-server
] curry "Distributed concurrency server" spawn drop ;
: start-node ( port -- )
if*
] [ accept-loop ] bi ; inline
-\ accept-loop ERROR add-error-logging
-
: start-accept-loop ( server -- )
threaded-server get encoding>> <server>
[ threaded-server get sockets>> push ]
[ [ accept-loop ] with-disposal ]
bi ;
+\ start-accept-loop ERROR add-error-logging
+
: init-server ( threaded-server -- threaded-server )
dup semaphore>> [
dup max-connections>> [
IN: io.sockets.secure.tests
-USING: io.sockets.secure tools.test ;
+USING: accessors kernel io.sockets io.sockets.secure tools.test ;
[ "hello" 24 ] [ "hello" 24 <inet> <secure> [ host>> ] [ port>> ] bi ] unit-test
-USING: listener io.servers.connection io.encodings.utf8 ;
+USING: listener io.servers.connection io.encodings.utf8
+accessors kernel ;
IN: tty-server
: <tty-server> ( port -- )
"tty-server" >>name
utf8 >>encoding
swap local-server >>insecure
- [ listener ] >>handler ;
+ [ listener ] >>handler
+ start-server ;
-: tty-server ( -- ) 9999 tty-server ;
+: tty-server ( -- ) 9999 <tty-server> ;
MAIN: tty-server
USING: math kernel accessors http.server http.server.dispatchers
-furnace furnace.actions furnace.sessions
+furnace furnace.actions furnace.sessions furnace.redirection
html.components html.forms html.templates.chloe
fry urls ;
IN: webapps.counter
+++ /dev/null
-! Copyright (c) 2008 Slava Pestov
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel sequences assocs io.files io.sockets
-io.server
-namespaces db db.tuples db.sqlite smtp
-logging.insomniac
-http.server
-http.server.dispatchers
-furnace.alloy
-furnace.auth.login
-furnace.auth.providers.db
-furnace.auth.features.edit-profile
-furnace.auth.features.recover-password
-furnace.auth.features.registration
-furnace.boilerplate
-webapps.blogs
-webapps.pastebin
-webapps.planet
-webapps.todo
-webapps.wiki
-webapps.wee-url
-webapps.user-admin ;
-IN: webapps.factor-website
-
-: test-db ( -- db params ) "resource:test.db" sqlite-db ;
-
-: init-factor-db ( -- )
- test-db [
- init-furnace-tables
-
- {
- post comment
- paste annotation
- blog posting
- todo
- short-url
- article revision
- } ensure-tables
- ] with-db ;
-
-TUPLE: factor-website < dispatcher ;
-
-: <factor-website> ( -- responder )
- factor-website new-dispatcher
- <blogs> "blogs" add-responder
- <todo-list> "todo" add-responder
- <pastebin> "pastebin" add-responder
- <planet-factor> "planet" add-responder
- <wiki> "wiki" add-responder
- <wee-url> "wee-url" add-responder
- <user-admin> "user-admin" add-responder
- "Factor website" <login-realm>
- "Factor website" >>name
- allow-registration
- allow-password-recovery
- allow-edit-profile
- <boilerplate>
- { factor-website "page" } >>template
- test-db <alloy> ;
-
-: init-factor-website ( -- )
- "factorcode.org" 25 <inet> smtp-server set-global
- "todo@factorcode.org" lost-password-from set-global
- "website@factorcode.org" insomniac-sender set-global
- "slava@factorcode.org" insomniac-recipients set-global
- init-factor-db
- <factor-website> main-responder set-global ;
-
-: start-factor-website ( -- )
- test-db start-expiring
- test-db start-update-task
- httpd-insomniac
- 8812 httpd ;
+++ /dev/null
-body, button {
- font:9pt "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif;
- color:#444;
-}
-
-.link-button {
- padding: 0px;
- background: none;
- border: none;
-}
-
-a, .link {
- color: #222;
- border-bottom:1px dotted #666;
- text-decoration:none;
-}
-
-a:hover, .link:hover {
- border-bottom:1px solid #66a;
-}
-
-.error { color: #a00; }
-
-.errors li { color: #a00; }
-
-.field-label {
- text-align: right;
-}
-
-.inline {
- display: inline;
-}
-
-.navbar {
- background-color: #eee;
- padding: 5px;
- border: 1px solid #ccc;
-}
-
-.big-field-label {
- vertical-align: top;
-}
-
-.description {
- padding: 5px;
- color: #000;
-}
-
-.description pre {
- border: 1px dashed #ccc;
- background-color: #f5f5f5;
-}
-
-.description p:first-child {
- margin-top: 0px;
-}
-
-.description p:last-child {
- margin-bottom: 0px;
-}
-
-.description table, .description td {
- border-color: #666;
- border-style: solid;
-}
-
-.description table {
- border-width: 0 0 1px 1px;
- border-spacing: 0;
- border-collapse: collapse;
-}
-
-.description td {
- margin: 0;
- padding: 4px;
- border-width: 1px 1px 0 0;
-}
-
+++ /dev/null
-<?xml version='1.0' ?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
- <t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
-
- <head>
- <t:write-title />
-
- <t:style t:include="resource:extra/xmode/code2html/stylesheet.css" />
-
- <t:style t:include="resource:extra/webapps/factor-website/page.css" />
-
- <t:write-style />
-
- <t:write-atom />
- </head>
-
- <body>
- <t:call-next-template />
- </body>
-
- </t:chloe>
-
-</html>