Make a c->write_packet method to support packet transmission for IS2

This commit is contained in:
Heikki Hannikainen 2013-07-02 08:49:27 +03:00
parent c87262b453
commit 50937afbf8
5 changed files with 15 additions and 5 deletions

View File

@ -524,3 +524,7 @@ int is2_deframe_input(struct worker_t *self, struct client_t *c, int start_at)
return i;
}
int is2_write_packet(struct worker_t *self, struct client_t *c, char *p, int len)
{
return 0;
}

View File

@ -11,6 +11,8 @@ extern int is2_input_handler(struct worker_t *self, struct client_t *c, IS2Messa
extern int is2_out_server_signature(struct worker_t *self, struct client_t *c);
extern int is2_deframe_input(struct worker_t *self, struct client_t *c, int start_at);
extern int is2_write_packet(struct worker_t *self, struct client_t *c, char *p, int len);
extern int is2_out_ping(struct worker_t *self, struct client_t *c);
#endif

View File

@ -35,7 +35,7 @@ static inline void send_single(struct worker_t *self, struct client_t *c, char *
else
clientaccount_add( c, c->ai_protocol, 0, 0, 0, 1, 0, 0);
c->write(self, c, data, len);
c->write_packet(self, c, data, len);
}
static void process_outgoing_single(struct worker_t *self, struct pbuf_t *pb)

View File

@ -1522,7 +1522,7 @@ static void collect_new_clients(struct worker_t *self)
}
c->handler_client_readable = &handle_corepeer_readable;
c->write = &udp_client_write;
c->write_packet = c->write = &udp_client_write;
continue;
}
@ -1557,11 +1557,14 @@ static void collect_new_clients(struct worker_t *self)
c->write = &tcp_client_write;
}
if (c->flags & CLFLAGS_IS2)
if (c->flags & CLFLAGS_IS2) {
c->handler_consume_input = &is2_deframe_input;
else
c->write_packet = &is2_write_packet;
} else {
c->handler_consume_input = &deframe_aprsis_input_lines;
c->write_packet = c->write;
}
/* The new client may end up destroyed right away, never mind it here.
* We will notice it later and discard the client.
*/

View File

@ -360,6 +360,7 @@ struct client_t {
int (*is2_input_handler) (struct worker_t *self, struct client_t *c, IS2Message *message);
int (*handler_consume_input) (struct worker_t *self, struct client_t *c, int start_at);
int (*write) (struct worker_t *self, struct client_t *c, char *p, int len);
int (*write_packet) (struct worker_t *self, struct client_t *c, char *p, int len);
int (*handler_client_readable) (struct worker_t *self, struct client_t *c);
int (*handler_client_writable) (struct worker_t *self, struct client_t *c);