On Wed, Jul 17, 2013 at 03:34:57PM +0200, hamza zia wrote: > Last patch just broke monkey logger plugin! updated the patch to make it > backwards compatible with old stage40 plugins > > hamza > > > On 17 July 2013 13:40, hamza zia <[email protected]> wrote: > > > Currently stage40 plugins are only run once monkey has no pending data to > > send, and they are only call once. A plugin may want to send some more data > > again in the next cycle. They can specify if they have more data to send by > > returning MK_PLUGIN_RET_CONTINUE and return MK_PLUGIN_RET_END to go to the > > next stage. I have attached a simple patch that implements this. What do > > you guys think? > >
Stage_40 is called when the stage is served, this is how it's meant to be. > > > > My use case with the cache plugin was that I had to take over the request > > if its a cache hit, and want to send data without blocking, so I can take > > over the socket in stage 30 but that doesnt work well with pipelined > > requests that monkey handles pretty nicely. So I tried to send data in > > STAGE40 but its only called once and this patch fixes that. Returning MK_PLUGIN_RET_CONTINUE will make the stage_30 call happen multiple times without processing any pipelined requests. This should be enough for your use case. You must make sure that you can detect whether a request has been handled or not by keeping some state around. If you're worried about overhead the event callbacks are handled before the stage_30, so after the initial stage_30 you can catch the request in event_write(). See https://lotrax.org/gsoc/two-common-monkey-plugin-patterns.html for some information about usual plugin patterns. The new plugin api is much more suitable for you use case, but it is still work in progress. If your interested, check out the 'static' plugin in the plugin_next branch on github. All file serving has been moved into that plugin and the intension is to have multiple file serving plugins with different features, such as caching. The plugin has the same features as monkey's current file serving. https://github.com/ksonny/monkey/tree/plugin_next > > > > hamza > > > _______________________________________________ > Monkey mailing list > [email protected] > http://lists.monkey-project.com/listinfo/monkey -- Sonny Karlsson _______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
