More proto parsing.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "json.h"
|
||||
#include "packet.h"
|
||||
#include "peer.h"
|
||||
#include "proto.h"
|
||||
#include "raw.h"
|
||||
#include "send.h"
|
||||
#include "uuid.h"
|
||||
@@ -47,6 +48,10 @@ struct parser {
|
||||
.name = "json",
|
||||
.parse = json_parse,
|
||||
},
|
||||
{
|
||||
.name = "proto",
|
||||
.parse = proto_parse,
|
||||
},
|
||||
{
|
||||
.name = "raw",
|
||||
.parse = raw_parse,
|
||||
@@ -99,7 +104,7 @@ static void receive_read(struct peer *peer) {
|
||||
struct packet packet = {
|
||||
.source_id = receive->id,
|
||||
};
|
||||
while (receive->parser_wrapper(receive, &packet)) {
|
||||
while (receive->buf.length && receive->parser_wrapper(receive, &packet)) {
|
||||
if (packet.type == PACKET_TYPE_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user