Clean up file and hello messes.

This commit is contained in:
Ian Gulliver
2016-02-29 20:49:36 -08:00
parent 90de5b80bc
commit b106887617
10 changed files with 89 additions and 66 deletions

17
adsbus/flow.c Normal file
View File

@@ -0,0 +1,17 @@
#include <unistd.h>
#include "buf.h"
#include "flow.h"
bool flow_hello(int fd, struct flow *flow, void *passthrough) {
if (!flow->get_hello) {
return true;
}
struct buf buf = BUF_INIT, *buf_ptr = &buf;
flow->get_hello(&buf_ptr, passthrough);
if (!buf_ptr->length) {
return true;
}
return (write(fd, buf_at(buf_ptr, 0), buf_ptr->length) == (ssize_t) buf_ptr->length);
}