Beispiel #1
0
/* ------------------- */
static void afp_dsi_timedown(int sig _U_)
{
    struct sigaction	sv;
    struct itimerval	it;
    DSI                 *dsi = (DSI *)AFPobj->handle;
    dsi->flags |= DSI_DIE;
    /* shutdown and don't reconnect. server going down in 5 minutes. */
    setmessage("The server is going down for maintenance.");
    if (dsi_attention(AFPobj->handle, AFPATTN_SHUTDOWN | AFPATTN_NORECONNECT |
                  AFPATTN_MESG | AFPATTN_TIME(5)) < 0) {
        DSI *dsi = (DSI *)AFPobj->handle;
        dsi->down_request = 1;
    }                  

    it.it_interval.tv_sec = 0;
    it.it_interval.tv_usec = 0;
    it.it_value.tv_sec = 300;
    it.it_value.tv_usec = 0;

    if ( setitimer( ITIMER_REAL, &it, NULL ) < 0 ) {
        LOG(log_error, logtype_afpd, "afp_timedown: setitimer: %s", strerror(errno) );
        afp_dsi_die(EXITERR_SYS);
    }
    memset(&sv, 0, sizeof(sv));
    sv.sa_handler = afp_dsi_die;
    sigemptyset( &sv.sa_mask );
    sigaddset(&sv.sa_mask, SIGHUP);
    sigaddset(&sv.sa_mask, SIGTERM);
    sv.sa_flags = SA_RESTART;
    if ( sigaction( SIGALRM, &sv, NULL ) < 0 ) {
        LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
        afp_dsi_die(EXITERR_SYS);
    }

    /* ignore myself */
    sv.sa_handler = SIG_IGN;
    sigemptyset( &sv.sa_mask );
    sv.sa_flags = SA_RESTART;
    if ( sigaction( SIGUSR1, &sv, NULL ) < 0 ) {
        LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGHUP: %s", strerror(errno) );
        afp_dsi_die(EXITERR_SYS);
    }
}
Beispiel #2
0
// tries to merge the vertex v with another
bool mergevertex(int v)
{
  int i;
  for (i=0;i<vertsnum;i++)
    if (verts[i].x==verts[v].x && verts[i].y==verts[v].y && v!=i) break;
  if (i==vertsnum) return false;
  Tcluster *c;
 loop:
  for (c=map->clusters;c;c=c->next) {
    Tsector *s;
    for (s=c->sectors;s;s=s->next) {
      Tline *l;
      for (l=s->lines;l;l=l->next) {
        if (l->v1==v) {
          l->v1=i;
          refs[i]++;
        }
        if (l->v2==v) {
          l->v2=i;
          refs[i]++;
        }
        if (l->v1==l->v2) {
          delline(map,c,s,l);
          goto loop;
        }
      }
    }
  }
  for (c=map->clusters;c;c=c->next) {
    Tsector *s;
    for (s=c->sectors;s;s=s->next) updatesector(s);
  }
  refs[v]=1;
  delvertex(v);
  compactverts();
  showvertices();
  setmessage("Vertex deleted",true);
  return true;
}
Beispiel #3
0
// メッセージ表示
// 改行対応なし(色指定あり)
//
void CWindows::setmessage(int x, int y, std::string message, int ch, int bg)
{
	setmessage(x, y, message, getcpair(ch, bg));
}
Beispiel #4
0
// メッセージ表示
// 改行対応なし(色指定なし)
//
void CWindows::setmessage(int x, int y, std::string message)
{
	setmessage(x, y, message, m_cpair);
}