Permalink
Browse files

Socket passed as parameter twice to function

  • Loading branch information...
1 parent b270c9a commit 1d3cc9f495ae2c8b2fd6d8f72128d54e62ca3261 @msantos committed Nov 2, 2010
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/seds.erl
View
13 src/seds.erl
@@ -88,12 +88,12 @@ init(Port, Opt) ->
}}.
-handle_call({send, {IP, Port, #dns_rec{} = Rec, #seds{} = Query}}, _From, #state{
- s = Socket
- } = State) ->
+handle_call({send, {IP, Port, #dns_rec{} = Rec,
+ #seds{type = Type, data = Data} = Query}}, _From,
+ State) ->
Session = seds_protocol:session(Query, map(State)),
- {Proxy, Proxies} = proxy(Socket, Session, State),
- ok = seds_proxy:send(Proxy, IP, Port, Rec, {Query#seds.type, Query#seds.data}),
+ {Proxy, Proxies} = proxy(Session, State),
+ ok = seds_proxy:send(Proxy, IP, Port, Rec, {Type, Data}),
{reply, ok, State#state{p = Proxies}};
handle_call(Request, _From, State) ->
@@ -137,7 +137,8 @@ code_change(_OldVsn, State, _Extra) ->
%%%
%%% Internal Functions
%%%
-proxy(Socket, {{ServerIP, ServerPort}, SessionId} = Session, #state{
+proxy({{ServerIP, ServerPort}, SessionId} = Session, #state{
+ s = Socket,
p = Proxies
}) ->
case dict:find(Session, Proxies) of

0 comments on commit 1d3cc9f

Please sign in to comment.