//	Function responsible of accepting a connection on the socket.
			inline Socket*	TCPSocket::accept()
			{
				Socket*				return_value = NULL;



				lock_ref().enter();

				if ( socket_ref() != NULL  &&  listen() )
				{
					sockaddr_storage	target;
					SOCKET				new_socket;
					int					target_size = sizeof(target);
				


					memset(&target,'\0',target_size);
					new_socket = WSAAccept(socket_ref(),reinterpret_cast<sockaddr*>(&target),&target_size,NULL,NULL);

					if ( new_socket != INVALID_SOCKET )
					{
						TCPSocket*	accepted_socket = new (std::nothrow) TCPSocket( ( protocol() == SOCKET_TCP_V4  ?  false : true ) , new_socket,target);



						if ( accepted_socket != NULL )
						{
							accepted_socket->queue_size(queue_size());
							accepted_socket->blocking(blocking());
							accepted_socket->send_timeout(send_timeout());
							accepted_socket->receive_timeout(receive_timeout());
							accepted_socket->keep_alive(keep_alive());
							accepted_socket->keep_alive_timeout(keep_alive_timeout());
							accepted_socket->keep_alive_interval(keep_alive_interval());
							accepted_socket->overlapped(overlapped());
							accepted_socket->send_overlapped_function(send_overlapped_function());
							accepted_socket->receive_overlapped_function(receive_overlapped_function());
							_accepted_sockets.push_back(accepted_socket);
							return_value = accepted_socket;
						}
						else
							closesocket(new_socket);
					}
				}

				lock_ref().leave();


				return return_value;
			};
Exemple #2
0
void register_button_press(struct ir_remote* remote, struct ir_ncode* ncode, ir_code code, int reps)
{
	if (reps == 0 && release_remote != NULL) {
		release_remote2 = release_remote;
		release_ncode2 = release_ncode;
		release_code2 = release_code;
	}

	release_remote = remote;
	release_ncode = ncode;
	release_code = code;
	release_reps = reps;
	/* some additional safety margin */
	release_gap = upper_limit(remote,
				  remote->max_total_signal_length - remote->min_gap_length)
		      + receive_timeout(upper_limit(remote, remote->min_gap_length)) + 10000;

	log_trace("release_gap: %lu", release_gap);

	register_input();
}
Exemple #3
0
 Object* Channel::receive(STATE, CallFrame* call_frame) {
   return receive_timeout(state, Qnil, call_frame);
 }
Exemple #4
0
 Object* Channel::receive(STATE, GCToken gct, CallFrame* call_frame) {
   return receive_timeout(state, gct, cNil, call_frame);
 }
lirc_t get_next_rec_buffer(lirc_t maxusec)
{
	return get_next_rec_buffer_internal(receive_timeout(maxusec));
}