Revision e773088f chunker_streamer/chunk_pusher.c

View differences:

chunker_streamer/chunk_pusher.c
32 32
static int peer_port;
33 33
static bool exit_on_connect_failure = false;
34 34
static bool connect_on_data = true;
35
#ifdef MSG_NOSIGNAL
36
static bool exit_on_send_error = false;
37
#else
38
static bool exit_on_send_error = true;
39
#endif
35
static bool exit_on_send_error = false;	//TODO: handle this on Mac
40 36

  
41 37
void initTCPPush(char* ip, int port)
42 38
{
......
217 213
		/* encode the GRAPES chunk into network bytes */
218 214
		encodeChunk(&gchunk, buffer + 4, buffer_size);
219 215
		*(uint32_t*)buffer = htonl(buffer_size);
220
		
216

  
217
#ifdef MSG_NOSIGNAL
221 218
		int ret = send(tcp_fd, buffer, 4 + buffer_size, exit_on_send_error ? 0 : MSG_NOSIGNAL); //TODO: better handling of exit_on_send_error
219
#else
220
		int ret = send(tcp_fd, buffer, 4 + buffer_size, 0); //TODO: better handling of exit_on_send_error
221
#endif
222 222
		//fprintf(stderr, "TCP IO-MODULE: sending %d bytes, %d sent\n", buffer_size, ret);
223 223
		if (ret < 0) {
224 224
			if (errno != EAGAIN && errno != EWOULDBLOCK) {
......
232 232
		int tmp;
233 233
		while(ret != buffer_size)
234 234
		{
235
#ifdef MSG_NOSIGNAL
235 236
			tmp = send(tcp_fd, buffer+ret, 4 + buffer_size - ret, exit_on_send_error ? 0 : MSG_NOSIGNAL);
237
#else
238
			tmp = send(tcp_fd, buffer+ret, 4 + buffer_size - ret, 0);
239
#endif
236 240
			if(tmp > 0)
237 241
				ret += tmp;
238 242
			else

Also available in: Unified diff