Ejemplo n.º 1
0
Archivo: imap4.c Proyecto: m8rge/dbmail
void socket_write_cb(int UNUSED fd, short UNUSED what, void *arg)
#endif
{
	ImapSession *session = (ImapSession *)arg;
	ClientState_T state;
	PLOCK(session->lock);
	state = session->state;
	PUNLOCK(session->lock);
#ifdef DEBUG
	TRACE(TRACE_DEBUG,"[%p] on [%d] state [%d] event:%s%s%s%s", session,
			(int) fd, state,
			(what&EV_TIMEOUT) ? " timeout": "",
			(what&EV_READ)    ? " read":    "",
			(what&EV_WRITE)   ? " write":   "",
			(what&EV_SIGNAL)  ? " signal":  ""
	     );
#endif
	switch(state) {
		case CLIENTSTATE_QUIT_QUEUED:
			break; // ignore
		case CLIENTSTATE_LOGOUT:
			imap_session_bailout(session);
			break;
		case CLIENTSTATE_ERROR:
			imap_handle_abort(session);
			break;
		default:
			ci_write_cb(session->ci);
			break;
	}
	dm_queue_drain();
}
Ejemplo n.º 2
0
Archivo: pop3.c Proyecto: skeyby/dbmail
void pop3_cb_write(void *arg)
{
    ClientSession_T *session = (ClientSession_T *)arg;
    int state = session->state;

    switch (state) {
    case CLIENTSTATE_QUIT_QUEUED:
    case CLIENTSTATE_QUIT:
        break;
    default:
        ci_write_cb(session->ci);
        session->handle_input(session);
        break;
    }
}
Ejemplo n.º 3
0
void pop3_cb_write(void *arg)
{
	ClientSession_t *session = (ClientSession_t *)arg;
	TRACE(TRACE_DEBUG, "[%p] state: [%d]", session, session->state);

	switch (session->state) {
		case CLIENTSTATE_QUIT:
			db_session_cleanup(session);
			client_session_bailout(&session);
			break;
		default:
			ci_write_cb(session->ci);
			session->handle_input(session);
			break;
	}
}
Ejemplo n.º 4
0
Archivo: imap4.c Proyecto: m8rge/dbmail
void imap_cleanup_deferred(gpointer data)
{
	int rx;
	dm_thread_data *D = (dm_thread_data *)data;
	ImapSession *session = (ImapSession *)D->session;
	ClientBase_T *ci = session->ci;

	if (ci->rev) event_del(ci->rev);
	if (ci_wbuf_len(ci)) {
		ci_write_cb(ci);
		dm_queue_push(imap_cleanup_deferred, session, NULL);
		return;
	}

	rx = ci->rx;
	ci_close(ci);
	ci = NULL;

	dbmail_imap_session_delete(&session);

	if (rx == STDIN_FILENO)
		exit(0);
}