| 126 | } |
| 127 | |
| 128 | int IOChannel::WriteToDest(int dest_fd, const char * buf, int write_size) { |
| 129 | MonitorPluginEntry::GetDefault()->GetMonitorPlugin()->WriteNetwork(write_size); |
| 130 | //for debug |
| 131 | // |
| 132 | if (config_->OpenDebugMode()) { |
| 133 | std::string debug_str; |
| 134 | GetMysqlBufDebugString(buf, write_size, debug_str); |
| 135 | LOG_DEBUG("dest %d command [%s]", dest_fd, debug_str.c_str()); |
| 136 | } |
| 137 | //for debug end |
| 138 | |
| 139 | int written_once = 0; |
| 140 | int total_written = 0; |
| 141 | while (total_written < write_size) { |
| 142 | written_once = RoutineWriteWithTimeout(dest_fd, buf + total_written, write_size - total_written, |
| 143 | config_->WriteTimeoutMs()); |
| 144 | if (written_once < 0) { |
| 145 | LOG_ERR("write to %d buf size [%d] failed, ret %d, errno (%d:%s)", |
| 146 | dest_fd, write_size, written_once, errno, strerror(errno)); |
| 147 | MonitorPluginEntry::GetDefault()->GetMonitorPlugin()->WriteNetworkFail(write_size); |
| 148 | return -__LINE__; |
| 149 | } |
| 150 | total_written += written_once; |
| 151 | } |
| 152 | return total_written; |
| 153 | } |
| 154 | |
| 155 | int IOChannel::TransMsgDirect(int source_fd, int dest_fd, struct pollfd pf[], int nfds) { |
| 156 | int byte_size = 0; |
nothing calls this directly
no test coverage detected