37 static const char* tcp_str =
"tcp";
113 ssize_t received = 0;
120 if (received == -1) {
121 if (errno == EAGAIN || errno == EINTR) {
125 if (errno != ECONNRESET) {
131 }
else if (received == 0) {
144 ods_log_error(
"[%s] packet too big, dropping connection", tcp_str);
153 if (received == -1) {
154 if (errno == EAGAIN || errno == EINTR) {
158 if (errno != ECONNRESET) {
164 }
else if (received == 0) {
191 uint16_t sendlen = htons(tcp->
msglen);
192 sent = write(tcp->
fd, (
const char*)&sendlen + tcp->
total_bytes,
195 if (errno == EAGAIN || errno == EINTR) {
213 if (errno == EAGAIN || errno == EINTR) {
238 if (!conn || !allocator) {
254 if (!
set || !allocator) {
258 tcp_conn_cleanup(set->tcp_conn[i], allocator);
tcp_set_type * tcp_set_create(allocator_type *allocator)
xfrd_type * tcp_waiting_last
void tcp_set_cleanup(tcp_set_type *set, allocator_type *allocator)
void * allocator_alloc(allocator_type *allocator, size_t size)
void buffer_skip(buffer_type *buffer, ssize_t count)
void buffer_clear(buffer_type *buffer)
tcp_conn_type * tcp_conn[TCPSET_MAX]
xfrd_type * tcp_waiting_first
void ods_log_error(const char *format,...)
int tcp_conn_write(tcp_conn_type *tcp)
uint8_t * buffer_current(buffer_type *buffer)
buffer_type * buffer_create(allocator_type *allocator, size_t capacity)
void buffer_set_limit(buffer_type *buffer, size_t limit)
size_t buffer_capacity(buffer_type *buffer)
#define PACKET_BUFFER_SIZE
tcp_conn_type * tcp_conn_create(allocator_type *allocator)
int tcp_conn_read(tcp_conn_type *tcp)
size_t buffer_remaining(buffer_type *buffer)
void allocator_deallocate(allocator_type *allocator, void *data)
void tcp_conn_ready(tcp_conn_type *tcp)
size_t buffer_position(buffer_type *buffer)
void buffer_cleanup(buffer_type *buffer, allocator_type *allocator)
#define ods_log_assert(x)