What is Megaphone?

What is Megaphone?
The Megaphone project is about enhancing open source chat software. Specifically, the goal is to allow ejabberd to support 1,000,000 simultaneous users. See The Plan page for more details on how I plan to solve this problem. See the About this Blog page for more details on why I created this blog.

Tuesday, March 6, 2012

A Correction

Previously...
  • Investigation revealed that ECM is sending raw TCP traffic to megaphone.
  • I determined that megaphone needed to listen for new connections.
  • I came to a conclusion regarding how to watch for new connections.

Upon further review I determined that the call to start up ejabberd_http_bind likely occurs in ejabberd_socket, not in ejabberd_listener as I had originally thought.  I now believe that the block of code that is used is:


start(Module, SockMod, Socket, Opts) ->
    case Module:socket_type() of
    xml_stream ->
        ...

    raw ->
        case Module:start({SockMod, Socket}, Opts) of
        {ok, Pid} ->
            case SockMod:controlling_process(Socket, Pid) of
            ok ->
                ok;
            {error, _Reason} ->
                SockMod:close(Socket)
            end;
        {error, _Reason} ->
            SockMod:close(Socket)
        end
    end.

with the actual blob of code being

    case Module:start({SockMod, Socket}, Opts) of

Therefore what I need to use is:

    ejabberd_http_bind:start({megaphone, <connection ID>}, undefined)

As usual I am sure that this is correct.  Unless it isn't.  Which is to say I'm probably dead wrong.

Next time: mods to call the new code (honest).

No comments:

Post a Comment