void
AsyncAccessManager::activator_replied (bool success, int pid)
{
  if (success)
    {
      if (pid == 0)
        {
          this->update_status (ImplementationRepository::AAM_WAIT_FOR_RUNNING);
        }
      else
        {
          if (ImR_Locator_i::debug () > 4)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::activator_replied with ")
                              ACE_TEXT ("pid = %d this pid = %d, status = %s\n"),
                              this, pid, this->info_->pid, status_name (this->status_)));
            }
          this->update_status (ImplementationRepository::AAM_SERVER_READY);
          this->info_.edit()->pid = pid;
          this->final_state ();
        }
    }
  else
    {
      this->status (ImplementationRepository::AAM_NO_ACTIVATOR);
      this->final_state ();
    }
}
示例#2
0
void status_redraw()
{
struct view_rec *v;
struct mark_rec *m;
struct sheet *s;
//v= (struct view_rec *)Mem::vmem_trans (active_view);
//s= (struct sheet *)Mem::vmem_trans (active_sheet);

v = my_active_view;                      // mod 8-27-93
s = my_active_sheet;                     // mod 8-25-93
statw.clearwin(YELLOW, _RED,' ');
statw.put(0,62, "R       C");
status_name();
m= get_mark (v->cursor);
status_block (v->block_active==view_rec::bk_on ? v->block_mode : -1);
DBG_STATUS(dout<<"status redraw row = "<<(m->row)<<endl);
DBG_STATUS(dout<<"status redraw col = "<<(m->col)<<endl);
status_row (m->row);
status_col (m->col);
status_delta (s->changed);
status_insertmode (v->flags&1);
status_indentmode (v->flags&2);
status_numlockmode ();
                                                        /* other indicators */
statw.put(0, 43, "ESC=menus F1=Help");
                                                        /* update color */
statw.highlight(0,0,settings.colors[STATUS_COLORS][NORMAL_COLOR],statw.get_width());
//statw.show();
}
void
AsyncAccessManager::ping_replied (LiveStatus server)
{
  if (ImR_Locator_i::debug () > 4)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::ping_replied %s,")
                      ACE_TEXT (" this status %s\n"),
                      this, LiveEntry::status_name (server), status_name (this->status_)));
    }

  switch (server)
    {
    case LS_ALIVE:
    case LS_LAST_TRANSIENT:
    case LS_TIMEDOUT:
      this->status (ImplementationRepository::AAM_SERVER_READY);
      break;
    case LS_DEAD:
      {
        if (this->status_ == ImplementationRepository::AAM_WAIT_FOR_PING)
          {
            if (this->info_->death_notify && this->info_->pid != 0)
              {
                if (ImR_Locator_i::debug () > 4)
                  {
                    ORBSVCS_DEBUG ((LM_DEBUG,
                                    ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::ping_replied pid = %d,")
                                    ACE_TEXT (" transition to WAIT_FOR_DEATH\n"),
                                    this, this->info_->pid));
                  }
                this->status (ImplementationRepository::AAM_WAIT_FOR_DEATH);
                return;
              }
            if (ImR_Locator_i::debug () > 4)
              {
                ORBSVCS_DEBUG ((LM_DEBUG,
                                ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::ping_replied pid = %d,")
                                ACE_TEXT (" trying to restart server\n"),
                                this, this->info_->pid));
              }
            if (this->send_start_request ())
              {
                return;
              }
          }
        else
          {
            this->status (ImplementationRepository::AAM_SERVER_DEAD);
          }
      }
      break;
    default:
      return;
    }
  this->final_state();
}
示例#4
0
const QString& server_info::meta_info_string() const
{
    if (meta_info_string_.isEmpty())
    {
        QStringList pl;
        foreach (const player_info& pi, players)
            pl += pi.nick_name();

        meta_info_string_ = QString("%1 %2 %3 %4 %5 %6 %7 %8").arg(name)
            .arg(id.address()).arg(country).arg(map).arg(mode_name()).arg(pl.join(" "))
                .arg(status_name()).arg(game_type);

    }
void
AsyncAccessManager::server_is_shutting_down (void)
{
  if (ImR_Locator_i::debug () > 4)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::server_is_shutting_down ")
                      ACE_TEXT ("on server <%C> pid=%d current status = %s\n"),
                      this, this->info_->ping_id(), this->info_->pid, status_name (this->status_)));
    }

  this->status (ImplementationRepository::AAM_SERVER_DEAD);
  this->final_state ();
}
void
AsyncAccessManager::shutdown_initiated (void)
{
  if (ImR_Locator_i::debug () > 4)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::shutdown_initiated ")
                      ACE_TEXT ("on server <%C> pid=%d current status = %s\n"),
                      this, this->info_->ping_id(), this->info_->pid, status_name (this->status_)));
    }

  this->status (ImplementationRepository::AAM_ACTIVE_TERMINATE);
  if (this->info_->pid != 0)
    {
      AsyncAccessManager_ptr aam (this->_add_ref());
      this->locator_.make_terminating (aam);
    }
  this->notify_waiters ();
}
示例#7
0
void
LiveEntry::reset_status (void)
{
  ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
  if ( this->liveliness_ == LS_ALIVE ||
       this->liveliness_ == LS_LAST_TRANSIENT ||
       this->liveliness_ == LS_TIMEDOUT)
    {
      this->liveliness_ = LS_UNKNOWN;
      this->repings_ = 0;
      this->next_check_ = ACE_High_Res_Timer::gettimeofday_hr();
    }
  if (ImR_Locator_i::debug () > 2)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) LiveEntry::reset_status this = %x, ")
                      ACE_TEXT ("server = %C status = %s\n"),
                      this, this->server_.c_str(),
                      status_name (this->liveliness_)));
    }

}
示例#8
0
void
LiveEntry::status (LiveStatus l)
{
  {
    ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
    this->liveliness_ = l;
    if (l == LS_ALIVE)
      {
        ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
        this->next_check_ = now + owner_->ping_interval();
      }
    if (l == LS_TRANSIENT && !this->reping_available())
      {
        this->liveliness_ = LS_LAST_TRANSIENT;
      }
  }
  this->update_listeners ();

  if (this->listeners_.size() > 0)
    {
      if (ImR_Locator_i::debug () > 2)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t) LiveEntry::status change, ")
                          ACE_TEXT ("server = %C status = %s\n"),
                          this->server_.c_str(),
                          status_name (this->liveliness_)));
        }
      this->owner_->schedule_ping (this);
    }
  else
    {
      if (this->owner_->remove_per_client_entry (this))
        {
          delete (this);
        }
    }
}
示例#9
0
void status_redraw()
{
struct view_rec *v;
struct mark_rec *m;
struct sheet *s;
//v= (struct view_rec *)Mem::vmem_trans (active_view);
//s= (struct sheet *)Mem::vmem_trans (active_sheet);

v = my_active_view;                      // mod 8-27-93
s = my_active_sheet;                     // mod 8-25-93
status_name();
m= get_mark (v->cursor);
status_block (v->block_active==view_rec::bk_on ? v->block_mode : -1);
DBG_STATUS(dout<<"status redraw row = "<<(m->row)<<endl);
DBG_STATUS(dout<<"status redraw col = "<<(m->col)<<endl);
status_quick_redraw(m->row, m->col, s->changed);
//statwptr[v->view_num]->put(0,75,(v->flags&1)?"I":"O");       // insert status
//status_numlockmode ();
                                                        /* other indicators */
//statwptr[v->view_num]->put(0, 43, "ESC=menus F1=Help");
                                                        /* update color */
statwptr[v->view_num]->highlight(0,0,settings.colors[STATUS_COLORS][NORMAL_COLOR],statwptr[v->view_num]->get_width());
//statwptr[v->view_num]->show();
}
示例#10
0
bool
LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next)
{
  if (this->liveliness_ == LS_PING_AWAY ||
      this->liveliness_ == LS_DEAD ||
      this->listeners_.size () == 0)
    {
      if (ImR_Locator_i::debug () > 4)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, status ")
                          ACE_TEXT ("= %s, listeners = %d server %C\n"),
                          status_name (this->liveliness_), this->listeners_.size (),
                          this->server_.c_str()));
        }
      return false;
    }
  ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
  ACE_Time_Value diff = this->next_check_ - now;
  long msec = diff.msec();
  if (msec > 0)
    {
      if (!want_reping || this->next_check_ < next)
        {
          want_reping = true;
          next = this->next_check_;
        }
      if (ImR_Locator_i::debug () > 2)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ")
                          ACE_TEXT ("status = %s, listeners = %d, ")
                          ACE_TEXT ("diff = %d,%d, msec = %d ")
                          ACE_TEXT ("server %C\n"),
                          status_name (this->liveliness_), this->listeners_.size (),
                          diff.sec(), diff.usec(), msec,
                          this->server_.c_str()));
        }
      return false;
    }
  switch (this->liveliness_)
    {
    case LS_UNKNOWN:
      break;
    case LS_ALIVE:
    case LS_TIMEDOUT:
      {
        ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false);
        this->next_check_ = now + owner_->ping_interval();
      }
      break;
    case LS_TRANSIENT:
    case LS_LAST_TRANSIENT:
      {
        int ms = this->next_reping ();
        if (ms != -1)
          {
            ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false);
            if (this->liveliness_ == LS_LAST_TRANSIENT)
              {
                this->liveliness_ = LS_TRANSIENT;
              }
            ACE_Time_Value next (ms / 1000, (ms % 1000) * 1000);
            this->next_check_ = now + next;
            if (ImR_Locator_i::debug () > 4)
              {
                ORBSVCS_DEBUG ((LM_DEBUG,
                                ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ")
                                ACE_TEXT ("transient, reping in %d ms, ")
                                ACE_TEXT ("server %C\n"),
                                ms, this->server_.c_str()));
              }
          }
        else
          {
            if (this->liveliness_ == LS_TRANSIENT)
              {
                ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, false);
                this->liveliness_ = LS_LAST_TRANSIENT;
              }
            if (ImR_Locator_i::debug () > 2)
              {
                ORBSVCS_DEBUG ((LM_DEBUG,
                                ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ")
                                ACE_TEXT ("transient, no more repings, ")
                                ACE_TEXT ("server %C\n"),
                                this->server_.c_str()));
              }
            if (this->listeners_.size() > 0)
              {
                this->update_listeners ();
              }
            return false;
          }
      }
      break;
    default:;
    }
  return true;
}
示例#11
0
/* write out nice info on the message,
 * and store in *user* data the info on progress.
 * */
int
process_message(ddjvu_message_t *message)
{

#if 0
   ddjvu_context_t* context= message->m_any.context;
#endif

   if (! message)
      return(-1);
#if DEBUG
   printf("*** %s: %s.\n",__FUNCTION__, message_tag_name(message->m_any.tag));
#endif


   switch (message->m_any.tag){
   case DDJVU_DOCINFO:
   {
      ddjvu_document_t* document= message->m_any.document;
      /* ddjvu_document_decoding_status  is set by libdjvu! */
      /* we have some info on the document  */
      LoadContext *lc = (LoadContext *) ddjvu_document_get_user_data(document);
      lc->pages = ddjvu_document_get_pagenum(document);
#if DEBUG
      printf("the doc has %d pages\n", ddjvu_document_get_pagenum(document));
#endif
      break;
   }
   case DDJVU_CHUNK:
#if DEBUG
           printf("the name of the chunk is: %s\n", message->m_chunk.chunkid);
#endif
           break;


   case DDJVU_RELAYOUT:
   case DDJVU_PAGEINFO:
   {
#if 0
      ddjvu_page_t* page = message->m_any.page;
      page_info* info = ddjvu_page_get_user_data(page);

      printf("page decoding status: %d %s%s%s\n",
             ddjvu_page_decoding_status(page),
             status_color, status_name(ddjvu_page_decoding_status(page)), color_reset);

      printf("the page LAYOUT changed: width x height: %d x %d @ %d dpi. Version %d, type %d\n",
             // printf("page info:\n width x height: %d x %d @ %d dpi, version %d, type %d\n",
             ddjvu_page_get_width(page),
             ddjvu_page_get_height(page),
             ddjvu_page_get_resolution(page),
             ddjvu_page_get_version(page),
             /* DDJVU_PAGETYPE_BITONAL */
             ddjvu_page_get_type(page));

      info->info = 1;
#endif
      break;
   }

   case DDJVU_REDISPLAY:
   {

#if 0
    ddjvu_page_t* page = message->m_any.page;
      page_info* info = ddjvu_page_get_user_data(page);

      printf("the page can/should be REDISPLAYED\n");
      info->display = 1;
#endif
      break;
   }

   case DDJVU_PROGRESS:
#if DEBUG
           printf("PROGRESS:\n");
#endif
           break;
   case DDJVU_ERROR:
           printf("simply ERROR!\n message:\t%s\nfunction:\t%s(file %s)\nlineno:\t%d\n",
                  message->m_error.message,
                  message->m_error.function,
                  message->m_error.filename,
                  message->m_error.lineno);
           break;
   case DDJVU_INFO:
#if DEBUG
           printf("INFO: %s!\n", message->m_info.message);
#endif
           break;
   default:
      printf("unexpected\n");
   };
  return(message->m_any.tag);
}
void
AsyncAccessManager::add_interest (ImR_ResponseHandler *rh, bool manual)
{
  {
    ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
    this->rh_list_.push_back (rh);
  }

  if (manual)
    {
      this->manual_start_ = true;
    }
  else if (this->is_terminating())
    {
      this->notify_waiters ();
      return;
    }

  if (ImR_Locator_i::debug () > 4)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::add_interest status = %s\n"),
                      this,
                      status_name (this->status_)));
    }

  this->info_.notify_remote_access (this->status_);

  if (this->info_->is_mode (ImplementationRepository::PER_CLIENT))
    {
     if (!this->send_start_request())
        {
          this->final_state();
        }
      return;
   }

  if (this->status_ == ImplementationRepository::AAM_SERVER_READY ||
      this->status_ == ImplementationRepository::AAM_SERVER_STARTED_RUNNING)
    {
      if (this->locator_.pinger().is_alive (this->info_->ping_id()) == LS_ALIVE)
        {
          this->status (ImplementationRepository::AAM_SERVER_READY);
          this->final_state();
          return;
        }
    }

  if (this->status_ == ImplementationRepository::AAM_INIT ||
      this->status_ == ImplementationRepository::AAM_SERVER_READY ||
      this->status_ == ImplementationRepository::AAM_SERVER_STARTED_RUNNING)
    {
      // This is not a leak. The listener registers with
      // the pinger and will delete itself when done.
      AccessLiveListener *l = 0;
      ACE_NEW (l, AccessLiveListener (this->info_->ping_id(),
                                     this,
                                     this->locator_.pinger()));
      LiveListener_ptr llp(l);
      if (!l->start())
        {
          if (!this->send_start_request())
            {
              this->final_state();
            }
        }
      else
        {
          if (this->status_ == ImplementationRepository::AAM_SERVER_STARTED_RUNNING)
            {
              this->update_status (ImplementationRepository::AAM_WAIT_FOR_ALIVE);
            }
          else
            {
              this->update_status (ImplementationRepository::AAM_WAIT_FOR_PING);
            }
        }
    }
}