Skip to content
Browse files

Drop the usage of parametrized modules in the ewgi gateways (it wasn'…

…t really needed and was getting in the way of a clean implementation of the push_streams).
  • Loading branch information...
1 parent 82d3eb0 commit d107fe0bbbf13052544642230748909499dadacc @davide davide committed Nov 3, 2009
Showing with 13 additions and 17 deletions.
  1. +4 −8 src/ewgi_api.erl
  2. +6 −6 src/server_gateways/ewgi_mochiweb.erl
  3. +3 −3 src/server_gateways/ewgi_yaws.erl
View
12 src/ewgi_api.erl
@@ -896,17 +896,13 @@ stream_process_init() ->
end.
stream_process_deliver({ServerModule, _ServerPid, Socket}, IoList) ->
- A = ServerModule:new(undefined),
- A:stream_process_deliver(Socket, IoList).
+ ServerModule:stream_process_deliver(Socket, IoList).
stream_process_deliver_chunk({ServerModule, _ServerPid, Socket}, IoList) ->
- A = ServerModule:new(undefined),
- A:stream_process_deliver_chunk(Socket, IoList).
+ ServerModule:stream_process_deliver_chunk(Socket, IoList).
stream_process_deliver_final_chunk({ServerModule, _ServerPid, Socket}, IoList) ->
- A = ServerModule:new(undefined),
- A:stream_process_deliver_final_chunk(Socket, IoList).
+ ServerModule:stream_process_deliver_final_chunk(Socket, IoList).
stream_process_end({ServerModule, ServerPid, Socket}) ->
- A = ServerModule:new(undefined),
- A:stream_process_end(ServerPid, Socket).
+ ServerModule:stream_process_end(ServerPid, Socket).
View
12 src/server_gateways/ewgi_mochiweb.erl
@@ -23,10 +23,10 @@
%%%
%%% Created : 12 Oct 2007 by Filippo Pacini <filippo.pacini@gmail.com>
%%%-------------------------------------------------------------------
--module(ewgi_mochiweb, [Appl]).
+-module(ewgi_mochiweb).
%% ewgi callbacks
--export([run/1]).
+-export([run/2]).
-include_lib("ewgi.hrl").
@@ -35,10 +35,10 @@
%%====================================================================
%% ewgi_server callbacks
%%====================================================================
-run(MochiReq) ->
+run(Appl, MochiReq) ->
try parse_arg(MochiReq) of
Req when ?IS_EWGI_REQUEST(Req) ->
- try process_application(ewgi_api:context(Req, ewgi_api:empty_response())) of
+ try process_application(Appl, ewgi_api:context(Req, ewgi_api:empty_response())) of
not_found ->
MochiReq:not_found();
Ctx when ?IS_EWGI_CONTEXT(Ctx) ->
@@ -90,10 +90,10 @@ handle_stream(R, Generator) ->
error_logger:error_report(io_lib:format("Invalid stream generator: ~p~n", [Generator])),
R:write_chunk([]).
-process_application(Ctx) when is_list(Appl) ->
+process_application(Appl, Ctx) when is_list(Appl) ->
Path = ewgi_api:path_info(Ctx),
process_mount_application(Ctx, Path, find_mount(Appl, Path));
-process_application(Ctx) ->
+process_application(Appl, Ctx) ->
ewgi_application:run(Appl, Ctx).
process_mount_application(_, _, {not_found, _}) ->
View
6 src/server_gateways/ewgi_yaws.erl
@@ -23,9 +23,9 @@
%%%
%%% Created : 12 Oct 2007 by Filippo Pacini <filippo.pacini@gmail.com>
%%%-------------------------------------------------------------------
--module(ewgi_yaws, [Appl]).
+-module(ewgi_yaws).
--export([run/1]).
+-export([run/2]).
-export([
stream_process_deliver/2,
stream_process_deliver_chunk/2,
@@ -54,7 +54,7 @@ stream_process_end(YawsPid, Socket) ->
%%====================================================================
%% ewgi_server callbacks
%%====================================================================
-run(Arg) ->
+run(Appl, Arg) ->
try parse_arg(Arg) of
Req when ?IS_EWGI_REQUEST(Req) ->
Ctx0 = ewgi_api:context(Req, ewgi_api:empty_response()),

0 comments on commit d107fe0

Please sign in to comment.
Something went wrong with that request. Please try again.