Skip to content

Commit

Permalink
Merge pull request #70 from onlychoice/add_bosh_path
Browse files Browse the repository at this point in the history
add bosh_path config option
  • Loading branch information
nniclausse committed Nov 12, 2013
2 parents 6c5f88e + c185617 commit 1ea95e4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
10 changes: 10 additions & 0 deletions docs/conf-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ for Websocket as following:
<option name="websocket_path" value="/chat"/>
Path for BOSH
------------------

You can use the following config option for setting the path to BOSH
request:

.. code-block:: xml
<option name="bosh_path" value="/http-bind"/>
.. _jabber-options-label:

XMPP/Jabber options
Expand Down
1 change: 1 addition & 0 deletions include/ts_profile.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
% protocol options
-record(proto_opts,
{ssl_ciphers = negociate, % for ssl only
bosh_path = "/http-bind/", % for bash only
websocket_path = "/chat", % for websocket only
retry_timeout = 10, % retry sending in microsec
idle_timeout = 600000, % timeout for local ack
Expand Down
10 changes: 5 additions & 5 deletions src/tsung/ts_bosh.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ connect(Host, Port, Opts) ->

connect(Host, Port, Opts, Type) when Type =:= 'tcp' ; Type =:= 'ssl' ->
Parent = self(),
Path = "/http-bind/",
Pid = spawn(fun() -> loop(Host, Port, Path, Opts, Type, Parent) end),
?DebugF("connect ~p ~p ~p ~p",[Host, Port, self(), Pid]),
[BoshPath | OtherOpts] = Opts,
Pid = spawn(fun() -> loop(Host, Port, BoshPath, OtherOpts, Type, Parent) end),
?DebugF("connect ~p ~p ~p ~p ~p",[Host, Port, BoshPath, self(), Pid]),
{ok, Pid}.

extract_domain("to='" ++ Rest) ->
Expand Down Expand Up @@ -115,8 +115,8 @@ close(Pid) ->
set_opts(Pid, _Opts) ->
Pid.

protocol_options(#proto_opts{}) ->
[].
protocol_options(#proto_opts{bosh_path = BoshPath}) ->
[BoshPath].

loop(Host, Port, Path, Opts, Type, Parent) ->
{A,B,C} = now(),
Expand Down
6 changes: 6 additions & 0 deletions src/tsung_controller/ts_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,12 @@ parse(Element = #xmlElement{name=option, attributes=Attrs},
NewProto = OldProto#proto_opts{websocket_path=Path},
lists:foldl( fun parse/2, Conf#config{proto_opts=NewProto},
Element#xmlElement.content);
"bosh_path" ->
Path = getAttr(string,Attrs, value, ?config(bosh_path)),
OldProto = Conf#config.proto_opts,
NewProto = OldProto#proto_opts{bosh_path=Path},
lists:foldl( fun parse/2, Conf#config{proto_opts=NewProto},
Element#xmlElement.content);
"file_server" ->
FileName = getAttr(Attrs, value),
case file:read_file_info(FileName) of
Expand Down

0 comments on commit 1ea95e4

Please sign in to comment.