Closed GoogleCodeExporter closed 9 years ago
This is not feasible, since you can later on set any option at runtime. Hence
there
is no sense of splitting to _init() and _start().
To start listening after the initialization is done, set the "ports" option
last.
Original comment by valenok
on 3 Jun 2009 at 11:11
I had exactly the same thinking when I started to use the new API. Furthermore
some
threading issues would just disappear. On the other hand some cool features
would
also disappear, like manipulating the uri callbacks at runtime.
After a lot of thinking (one minute) I tend to prefer also to have a two phase
start
up procedure.
Anyway, thank you Sergey for the great EMBEDDED webserver.
Original comment by Mario.Kl...@googlemail.com
on 3 Jun 2009 at 11:48
Could you elaborate more, why would you prefer to split?
Do you mean making mg_set_option() valid only at init time?
Original comment by valenok
on 3 Jun 2009 at 11:59
Just call it "old-fashioned thinking". This term describes it very well. It is
the
way I'm dealing with resources in other circumstances. First step, create the
resource (here a webserver interface), second step, setup the resource, third
step,
utilize the resource.
Yes, mg_set_* functions would only be used at init time.
BTW, this discussion already improved my code. I changed the order of my
mg_set_*
calls. Now, setting the "ports" option is the last one.
Original comment by Mario.Kl...@googlemail.com
on 3 Jun 2009 at 2:34
Making mg_set_option() init-time-only looks quite restrictive to me, having that
there is no actual need for that. I think of having a possibility to change any
thing
dynamically as a benefit, so why sacrificing it?
Original comment by valenok
on 3 Jun 2009 at 2:49
If by putting "set ports" last will prevent unwanted connection, that works for
me.
As a matter of fact, being able to on-the-fly add or remove URI handlers could
come
in handy at times.
Thanks.
Original comment by PKuo...@gmail.com
on 4 Jun 2009 at 8:11
Original issue reported on code.google.com by
PKuo...@gmail.com
on 3 Jun 2009 at 2:28