Arc Forumnew | comments | leaders | submitlogin
Quitting the arc server
5 points by noobie 92 days ago | 3 comments
After starting up the basic hello world server in the tutorial, I wanted to quit because I could not run the other (defop ..) macros.

Why doesn't (= quitsrv* t) work? Doesn't the anarki documentation say that this setting quitsrv* to true would "flag to shutdown server"?

( This might be a dumb question - I'm new here.


4 points by akkartik 92 days ago | link

Not a dumb question at all; there may well be something broken here.

It'll be a few hours before I can try running it, but one possibility: perhaps it will quit after serving one further request? Looking at the code ( I think it's waiting on serve-socket before it gets around to checking quitsrv again. Can you try that if you haven't already?


4 points by noobie 91 days ago | link

Thank you for your help!! Could you help me understand what you'd like me to do?

I'm not sure what you think I should try.

After looking up the definition of the 'until' macro, the line of code referenced seems to tell me: if quitsrv* is not nil, then continue to serve-socket, which looks to me, at a noobie's glance, as returning the function "accept-request-with-deadline", opening up threads to serve the request?

i.e., quitsrv* now returns t. According to this definition, doesn't that mean that serve-socket should stop?

And incidentally, when I run more defop macro calls, it returns the 'procedure' but (asv) doesn't work; none of the new page on localhost show up (instead it is "Unknown"). I'll look more into it but not really sure how to proceed after glancing at (def asv).

I've copied down the definitions for while and whilet from arc.arc but they don't seem helpful at first glance. Will look further into them if you think it would be useful.

Thank you!!


4 points by akkartik 91 days ago | link

Not at all. I meant that if your server doesn't serve much traffic it'll spend much of its time inside serve-socket blocked on a new connection. It's only after serving a connection that it'll loop around to check quitsrv.

I just ran an experiment, and indeed the server stops after one more request:

    $ ./run-news
    initializing arc..
    ready to serve port 8080
    arc> (= quitsrv* t)
    ; now browse to localhost:8080; page served
    quit server ; printed by *serve*
    ; hit reload on localhost:8080; no response