$(PROGRAMS): $$(patsubst %.c,.%.o,$$($$@_SOURCES)) Makefile
$(CC) -o $@ $(CFLAGS) $(filter %.o,$^) $(LDFLAGS) $($@_LIBADD) $(filter %.a,$^)
--include $(foreach p,$(PROGRAMS),$(patsubst %.c,%.d,$(filter %.c,$p_SOURCES)))
+-include $(foreach p,$(PROGRAMS),$(patsubst %.c,.%.d,$(filter %.c,$p_SOURCES)))
###########################################################################}}}
void job_release(job_t **job)
{
if (*job) {
- if ((*job)->task && (*job)->task->stop) {
- (*job)->task->stop(*job);
+ if ((*job)->stop) {
+ (*job)->stop(*job);
}
job_delete(job);
}
return NULL;
}
- res = job_new();
- res->fd = sock;
- res->state = state;
- res->task = listener->task;
+ res = job_new();
+ res->fd = sock;
+ res->state = state;
+ res->process = listener->process;
+ res->stop = listener->stop;
return job_register_fd(res);
}
typedef struct job_t job_t;
typedef struct jpriv_t jpriv_t;
-typedef struct task_t task_t;
-typedef struct tpriv_t tpriv_t;
typedef struct query_t query_t;
-struct task_t {
- void (*start)(job_t *, query_t *);
- void (*stop)(job_t *);
- void (*cancel)(job_t *);
- void (*process)(job_t *);
-
- tpriv_t *tdata;
-};
-
struct job_t {
unsigned state : 6;
unsigned done : 1;
int fd;
- task_t *task;
+ void (*stop)(job_t *);
+ void (*process)(job_t *);
+
jpriv_t *jdata;
};
buffer_t obuf;
};
-struct tpriv_t {
- job_t *jobs;
-};
-
void postfix_start(job_t *job, query_t *query)
{
}
if (!strstr(job->jdata->ibuf.data, "\r\n\r\n"))
return;
+ job->state &= ~JOB_READ;
+
/* TODO: do the parse */
}
}