示例#1
0
int MySQL_Data_Stream::write_to_net_poll() {
	int rc=0;
	if (active==FALSE) return rc;	
	proxy_debug(PROXY_DEBUG_NET,1,"Session=%p, DataStream=%p --\n", sess, this);
	if (queue_data(queueOUT)) {
		if ((sess->admin==false)) {
			//if (poll_fds_idx>-1 && (mypolls->fds[poll_fds_idx].revents & POLLOUT)) {
			if (poll_fds_idx>-1) { // NOTE: attempt to force writes
				if (net_failure==false)
					rc=write_to_net();
			}
		} else {
			rc=write_to_net();
		}
	}
	if (fd>0 && sess->admin==false) set_pollout();
	return rc;
}
示例#2
0
void NetStream::flush_data()
{
   int count = _out_queue.count();
   if (!count) return;
   if (Config::get_var_bool("PRINT_ERRS",false,true)) 
      cerr << "NetStream: sending message to net of length " << count << endl;
   
   // Pack up 
   int packcount = 0;
   char packbuf_space[sizeof(int)];
   char *packbuf = packbuf_space;
   UGA_PACK_WORD(count, packbuf, packcount);

   write_to_net(packbuf_space, packcount);
   flush();
}