37 static const char* tcp_str =
"tcp";
105 ssize_t received = 0;
107 ods_log_assert(tcp->
fd != -1);
112 if (received == -1) {
113 if (errno == EAGAIN || errno == EINTR) {
117 if (errno != ECONNRESET) {
118 ods_log_error(
"[%s] error read() sz: %s", tcp_str,
123 }
else if (received == 0) {
136 ods_log_error(
"[%s] packet too big, dropping connection", tcp_str);
145 if (received == -1) {
146 if (errno == EAGAIN || errno == EINTR) {
150 if (errno != ECONNRESET) {
151 ods_log_error(
"[%s] error read(): %s", tcp_str,
156 }
else if (received == 0) {
181 ods_log_assert(tcp->
fd != -1);
183 uint16_t sendlen = htons(tcp->
msglen);
184 sent = write(tcp->
fd, (
const char*)&sendlen + tcp->
total_bytes,
187 if (errno == EAGAIN || errno == EINTR) {
205 if (errno == EAGAIN || errno == EINTR) {
249 tcp_conn_cleanup(set->tcp_conn[i]);
xfrd_type * tcp_waiting_last
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
int tcp_conn_write(tcp_conn_type *tcp)
uint8_t * buffer_current(buffer_type *buffer)
tcp_conn_type * tcp_conn_create()
void buffer_set_limit(buffer_type *buffer, size_t limit)
void buffer_cleanup(buffer_type *buffer)
size_t buffer_capacity(buffer_type *buffer)
void tcp_set_cleanup(tcp_set_type *set)
#define PACKET_BUFFER_SIZE
int tcp_conn_read(tcp_conn_type *tcp)
size_t buffer_remaining(buffer_type *buffer)
void tcp_conn_ready(tcp_conn_type *tcp)
size_t buffer_position(buffer_type *buffer)
tcp_set_type * tcp_set_create()
buffer_type * buffer_create(size_t capacity)