コード例 #1
0
int SrsConnection::cycle()
{
    int ret = ERROR_SUCCESS;
    
    _srs_context->generate_id();
    ip = srs_get_peer_ip(st_netfd_fileno(stfd));
    
    ret = do_cycle();
    
    // if socket io error, set to closed.
    if (srs_is_client_gracefully_close(ret)) {
        ret = ERROR_SOCKET_CLOSED;
    }
    
    // success.
    if (ret == ERROR_SUCCESS) {
        srs_trace("client finished.");
    }
    
    // client close peer.
    if (ret == ERROR_SOCKET_CLOSED) {
        srs_warn("client disconnect peer. ret=%d", ret);
    }
    
    // set loop to stop to quit.
    pthread->stop_loop();

    return ERROR_SUCCESS;
}
コード例 #2
0
void SrsConnection::cycle()
{
	int ret = ERROR_SUCCESS;
	
	_srs_context->generate_id();
	connection_id = _srs_context->get_id();
	
	ret = do_cycle();
	
	// if socket io error, set to closed.
	if (ret == ERROR_SOCKET_READ || ret == ERROR_SOCKET_READ_FULLY || ret == ERROR_SOCKET_WRITE) {
		ret = ERROR_SOCKET_CLOSED;
	}
    
	// success.
	if (ret == ERROR_SUCCESS) {
		srs_trace("client process normally finished. ret=%d", ret);
	}
	
	// client close peer.
	if (ret == ERROR_SOCKET_CLOSED) {
		srs_trace("client disconnect peer. ret=%d", ret);
	}
	
	server->remove(this);
}
コード例 #3
0
ファイル: tcpcryptd.c プロジェクト: Inzulus/tcpcrypt
void tcpcryptd(void)
{
	_state.s_divert = divert_open(_conf.cf_port, packet_handler);

	open_unix();

	drop_privs();

	printf("Running\n");

	if (!_conf.cf_disable && !_conf.cf_disable_network_test)
		test_network();

	while (1)
		do_cycle();
}
コード例 #4
0
int SrsServer::cycle()
{
    int ret = ERROR_SUCCESS;

    ret = do_cycle();

#ifdef SRS_AUTO_GPERF_MC
    destroy();
    
    srs_warn("sleep a long time for system st-threads to cleanup.");
    st_usleep(3 * 1000 * 1000);
    srs_warn("system quit");
#else
    srs_warn("main cycle terminated, system quit normally.");
    exit(0);
#endif
    
    return ret;
}
コード例 #5
0
ファイル: Parse.cpp プロジェクト: Liscar/jmc
bool parse_tintin_command(char *command, char *arg)
{
  /*
   this lines almost totally rewrote to put all command functions
   into a struct array. Size of array defined in tintin.h;
   Array itself defined in cmds.h.
   Struct:
    char alias    - with it you can easily add aliases with same function name
	void function_name - main stuff
	char hlpfile  - this field is for help_command. do not forget to link 
	                aliases to one help file.
	would rely it would not crash... En.
  */
  CharLower(command);

  if(isdigit(*command)) {
	  int a1=0;
	  int a2=0;
  	  sscanf(command,"%d:%d",&a1,&a2);
	  get_arg_in_braces(arg, arg, WITH_SPACES);

    do_cycle(      1,     a1,    1,         a2,  arg    );
 /* do_cycle( bound1, bound2, step,      delay,  command); */
    return false;
  }

  if(*command == cCommandChar) return false;

  for(int i=0;i<JMC_CMDS_NUM;i++)
	  if((command[0]==jmc_cmds[i].alias[0])
		  &&(is_abrev(command,jmc_cmds[i].alias)))
	  {
		  (*(jmc_cmds[i].jmcfn))(arg);
		  return true;
	  }
  
  tintin_puts2(rs::rs(1145));
  return false;
}