Exemplo n.º 1
0
/* SET SPLITMODE */
static void
quote_splitmode(struct Client *source_p, char *charval)
{
  if (charval)
  {
    int newval;

    for (newval = 0; splitmode_values[newval]; newval++)
    {
      if (irccmp(splitmode_values[newval], charval) == 0)
        break;
    }

    /* OFF */
    if (newval == 0)
    {
      sendto_realops_flags(UMODE_ALL, L_ALL, 
                           "%s is disabling splitmode",
                           get_oper_name(source_p));

      splitmode = 0;
      splitchecking = 0;

      eventDelete(check_splitmode, NULL);
    }
    /* ON */
    else if (newval == 1)
    {
      sendto_realops_flags(UMODE_ALL, L_ALL,
                           "%s is enabling and activating splitmode",
	                   get_oper_name(source_p));
		 
      splitmode = 1;
      splitchecking = 0;

      /* we might be deactivating an automatic splitmode, so pull the event */
      eventDelete(check_splitmode, NULL);
    }
    /* AUTO */
    else if (newval == 2)
    {
      sendto_realops_flags(UMODE_ALL, L_ALL,
                           "%s is enabling automatic splitmode",
			   get_oper_name(source_p));

      splitchecking = 1;
      check_splitmode(NULL);
    }
  }
  else
    /* if we add splitchecking to splitmode*2 we get a unique table to 
     * pull values back out of, splitmode can be four states - but you can
     * only set to three, which means we cant use the same table --fl_
     */
    sendto_one(source_p, ":%s NOTICE %s :SPLITMODE is currently %s", 
               me.name, source_p->name, 
	       splitmode_status[(splitchecking + (splitmode*2))]);
}
Exemplo n.º 2
0
static void
peerSelectCallback(ps_state * psstate)
{
	StoreEntry *entry = psstate->entry;
	FwdServer *fs = psstate->servers;
	void *data = psstate->callback_data;
	if (entry)
	{
		debug(44, 3) ("peerSelectCallback: %s\n", storeUrl(entry));
		if (entry->ping_status == PING_WAITING)
			eventDelete(peerPingTimeout, psstate);
		entry->ping_status = PING_DONE;
	}
	if (fs == NULL)
	{
		debug(44, 1) ("Failed to select source for '%s'\n", storeUrl(entry));
		debug(44, 1) ("  always_direct = %d\n", psstate->always_direct);
		debug(44, 1) ("   never_direct = %d\n", psstate->never_direct);
		debug(44, 1) ("       timedout = %d\n", psstate->ping.timedout);
	}
	psstate->ping.stop = current_time;
	psstate->request->hier.ping = psstate->ping;
	if (cbdataValid(data))
	{
		psstate->servers = NULL;
		psstate->callback(fs, data);
	}
	cbdataUnlock(data);
	peerSelectStateFree(psstate);
}
Exemplo n.º 3
0
void
peerMonitorNow(peer * peer)
{
    PeerMonitor *pm = peer->monitor.data;
    if (pm && !pm->running.req) {
	eventDelete(peerMonitorRequest, pm);
	peerMonitorRequest(pm);
    }
}
Exemplo n.º 4
0
static int hook_cleanup(cc_module *module)
{
	debug(207, 1)("(mod_m3u8_prefetch) ->	hook_cleanup:\n");
	eventDelete(m3u8Event, NULL);
	if(NULL != request_param_pool)
		memPoolDestroy(request_param_pool);
	if(NULL != mod_config_pool)
		memPoolDestroy(mod_config_pool);
	return 0;
}
Exemplo n.º 5
0
static void
peerMonitorCompleted(PeerMonitor * pm)
{
    int state = PEER_ALIVE;
    peer *p = pm->peer;
    storeClientUnregister(pm->running.sc, pm->running.e, pm);
    storeUnlockObject(pm->running.e);
    requestUnlink(pm->running.req);
    memFree(pm->running.buf, MEM_4K_BUF);
    if (pm->running.timeout_set) {
	eventDelete(peerMonitorTimeout, pm);
	pm->running.timeout_set = 0;
    }
    if (!cbdataValid(pm->peer)) {
	cbdataFree(pm);
	return;
    }
    /* Figure out if the response was OK or not */
    if (pm->running.status != HTTP_OK) {
	debug(DBG, 1) ("peerMonitor %s: Failed, status != 200 (%d)\n",
	    p->name, pm->running.status);
	state = PEER_DEAD;
    } else if (pm->running.size < p->monitor.min) {
	debug(DBG, 1) ("peerMonitor %s: Failed, reply size %d < min %d\n",
	    p->name, pm->running.size, p->monitor.min);
	state = PEER_DEAD;
    } else if (pm->running.size > p->monitor.max && p->monitor.max > 0) {
	debug(DBG, 1) ("peerMonitor %s: Failed, reply size %d > max %d\n",
	    p->name, pm->running.size, p->monitor.max);
	state = PEER_DEAD;
    } else {
	debug(DBG, 2) ("peerMonitor %s: OK\n", p->name);
    }
    p->monitor.state = state;
    if (state != p->stats.logged_state) {
	switch (state) {
	case PEER_ALIVE:
	    debug(DBG, 1) ("Detected REVIVED %s: %s\n",
		neighborTypeStr(p), p->name);
	    peerClearRR();
	    break;
	case PEER_DEAD:
	    debug(DBG, 1) ("Detected DEAD %s: %s\n",
		neighborTypeStr(p), p->name);
	    break;
	}
	p->stats.logged_state = state;
    }
    memset(&pm->running, 0, sizeof(pm->running));
    eventAdd(pm->name, peerMonitorRequest, pm, (double) (pm->last_probe + pm->peer->monitor.interval - current_dtime), 1);
}
Exemplo n.º 6
0
static void
peerRefreshDNS(void *data)
{
    peer *p = NULL;
    if (eventFind(peerRefreshDNS, NULL))
	eventDelete(peerRefreshDNS, NULL);
    if (!data && 0 == stat5minClientRequests()) {
	/* no recent client traffic, wait a bit */
	eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 180.0, 1);
	return;
    }
    for (p = Config.peers; p; p = p->next) {
	ipcache_nbgethostbyname(p->host, peerDNSConfigure, p);
    }
    /* Reconfigure the peers every hour */
    eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 3600.0, 1);
}
Exemplo n.º 7
0
void PhpSFTPHandler::OnFileDeleted(clFileSystemEvent& e)
{
    e.Skip();
    if(!PHPWorkspace::Get()->IsOpen()) { return; }

    SSHWorkspaceSettings settings;
    settings.Load();
    
    if(!EnsureAccountExists(settings)) { return; }
    
    const wxArrayString& paths = e.GetPaths();
    if(paths.IsEmpty()) { return; }
    
    for(size_t i = 0; i < paths.size(); ++i) {
        wxString remotePath = GetRemotePath(settings, paths.Item(i));
        if(remotePath.IsEmpty()) { return; }
        
        // Fire this event, if the sftp plugin is ON, it will handle it
        clSFTPEvent eventDelete(wxEVT_SFTP_DELETE_FILE);
        eventDelete.SetAccount(settings.GetAccount());
        eventDelete.SetRemoteFile(remotePath);
        EventNotifier::Get()->AddPendingEvent(eventDelete);
    }
}