예제 #1
0
void on_process_packet(struct connection *c,rpacket_t r)
{
	send2_all_client(r);
	++send_request;
	rpacket_destroy(&r);
	++packet_recv;	
}
예제 #2
0
void on_process_packet(struct connection *c,rpacket_t r)
{
	//send2_all_client(r);
	wpacket_t w = wpacket_create_by_rpacket(wpacket_allocator,r);
	connection_send(c,w,NULL);	
	++send_request;
	
	total_bytes_recv += rpacket_len(r);
	rpacket_destroy(&r);
	++packet_recv;	
}
예제 #3
0
void on_process_packet(struct connection *c,rpacket_t r)
{
	//uint32_t i = 0;
	//send2_all_client(r);
	uint32_t pk_size = rpacket_len(r);
	
	wpacket_t w = wpacket_create_by_rpacket(r);
	printf("pk_size:%d\n",pk_size);
	connection_send(c,w,0);
	rpacket_destroy(&r);
	//++packet_recv;	
}
예제 #4
0
void on_process_packet(struct connection *c,rpacket_t r)
{
	uint32_t coro_id = rpacket_read_uint32(r);
	const  char *function_name = rpacket_read_string(r);
	int32_t arg1 = rpacket_read_uint32(r);
	int32_t arg2 = rpacket_read_uint32(r);
	uint32_t i = 0;
	wpacket_t w = wpacket_create(SINGLE_THREAD,wpacket_allocator,64,0);
	wpacket_write_uint32(w,coro_id);
	if(strcmp(function_name,"sum") == 0)
		wpacket_write_uint32(w,arg1+arg2);
	else
		wpacket_write_uint32(w,arg1*arg2);
	assert(w);
	connection_send(c,w,NULL);
	rpacket_destroy(&r);
}