pike.git / lib / modules / Remote.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/Remote.pmod/module.pmod:265:    void close()    {    want_close = 1;   #if constant(thread_create)    calls->write(0);   #else    try_close();   #endif    }    -  void destroy() +  protected void _destruct()    {    catch (try_close());    }       void try_close()    {    if (closed) return;      #if constant(thread_create)    Thread.MutexKey fc_lock = finished_calls_cond_mutex->lock();
pike.git/lib/modules/Remote.pmod/module.pmod:408: Inside #if constant(thread_create)
   finished_calls_cond->broadcast();    lock = 0;   #else    finished_calls[ refno ] = result;   #endif    }       mixed get_result(int refno)    {    mixed r = finished_calls[refno]; -  if (zero_type(r)) +  if (undefinedp(r))    error("Tried to get a result too early.\n");    m_delete(finished_calls, refno);    return r;    }       void return_error(int refno, mixed err)    {    string s = encode_value(ctx->encode_error_return(refno,    describe_backtrace(err)));    send(sprintf("%4c%s", sizeof(s), s));
pike.git/lib/modules/Remote.pmod/module.pmod:645:    // werror("call_sync["+con->query_address()+"]["+refno+"] starting\n");    string s = encode_value(data);    pending_calls[refno] = 1;    mixed err = catch    {   #if constant(thread_create)    object lock = finished_calls_cond_mutex->lock();   #endif    send(sprintf("%4c%s", sizeof(s), s)); // Locks write_buffer_cond_mutex.   #if constant(thread_create) -  while(!closed && zero_type(finished_calls[refno])) +  while(!closed && !has_index(finished_calls, refno))    finished_calls_cond->wait(lock);    lock = 0;   #else    con->set_blocking(); -  while(!closed && zero_type(finished_calls[refno])) +  while(!closed && !has_index(finished_calls, refno))    read_once();   #endif    if (errors[refno]) {    string e = errors[refno];    m_delete (errors, refno);    error ("Remote error: " + e + ".\n");    }    };    m_delete (pending_calls, refno);    mixed err2 = catch {
pike.git/lib/modules/Remote.pmod/module.pmod:672:    con->set_nonblocking(read_some, write_some, closed_connection);   #endif    if (want_close) try_close();    };    if (err || err2)    {    catch(get_result(refno));    throw (err || err2);    }    // werror("call_sync["+con->query_address()+"]["+refno+"] done\n"); -  if (zero_type(finished_calls[refno])) { +  if (!has_index(finished_calls, refno)) {    DEBUGMSG("connection closed in sync call " + refno + "\n");    catch(get_result(refno));    if (!nice)    error("Could not read.\n");    else    return UNDEFINED;    }    return get_result(refno);    }