pike.git / lib / modules / Protocols.pmod / EngineIO.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/EngineIO.pmod:143:       //! Contains the last request seen on this connection.    //! Can be used to obtain cookies etc.    final Protocols.WebSocket.Request request;       //! The unique session identifier (in the Engine.IO docs referred    //! to as simply: id).    final string sid;       private mixed id; // This is the callback parameter -  private mapping options; +  protected mapping options;    private Stdio.Buffer ci = Stdio.Buffer();    private function(mixed, string|Stdio.Buffer:void) read_cb;    private function(mixed:void) close_cb;    private Thread.Queue sendq = Thread.Queue();    private ADT.Queue recvq = ADT.Queue();    private string curtransport;    private Transport conn;    private Transport upgtransport;    private enum {RUNNING = 0, PAUSED, SCLOSING, RCLOSING};    private int state = RUNNING;
pike.git/lib/modules/Protocols.pmod/EngineIO.pmod:178:    protected void destroy() {    droptimeout();    }       final protected void kickwatchdog() {    droptimeout();    call_out(close, pingtimeout);    }       //! Close the transport. -  final void close() { +  void close() {    droptimeout();    read_cb(FORCECLOSE);    }       final protected void sendqempty() {    if (!sendq.size())    read_cb(SENDQEMPTY);    }    }   
pike.git/lib/modules/Protocols.pmod/EngineIO.pmod:430:    }    }       class WebSocket {    inherit Transport:t;       private Protocols.WebSocket.Connection con;    private Stdio.Buffer bb = Stdio.Buffer();    private String.Buffer sb = String.Buffer();    +  final void close() { +  if (con) +  catch(con.close()); +  } +     protected void create(Protocols.WebSocket.Request req,    Protocols.WebSocket.Connection _con) {    con = _con;    con.onmessage = recv; -  con.onclose = close; +  con.onclose = ::close;    t::create(req);    }       final void flush(void|int type, void|string|Stdio.Buffer msg) {    void sendit() {    con.send_text(sprintf("%c%s",type,stringp(msg) ? msg : msg->read()));    };    if (msg)    sendit();    else {
pike.git/lib/modules/Protocols.pmod/EngineIO.pmod:531:    PD("Queue %s %c:%O\n", sid, type, (string)(msg || ""));    sendq.write(({type, msg || ""}));    switch (state) {    case RUNNING:    case SCLOSING:    flush();    }    }       private void flush() { -  if(catch(conn.flush())) +  if(catch(conn.flush())) {    catch(conn.close()); -  +  if (upgtransport) +  catch(upgtransport.close());    } -  +  }       private void flushrecvq() {    while (read_cb && !recvq.is_empty())    read_cb(query_id(), recvq.read());    }       //! Close the socket signalling the other side.    final void close() {    if (state < SCLOSING) {    if (close_cb)