| 216 | } |
| 217 | |
| 218 | int32_t CNetHandler::CheckParams() |
| 219 | { |
| 220 | if ((NULL == _req_data) || (_req_len == 0)) |
| 221 | { |
| 222 | MTLOG_ERROR("param invalid, data[%p], len[%u]", _req_data, _req_len); |
| 223 | return RC_INVALID_PARAM; |
| 224 | } |
| 225 | |
| 226 | if ((_dest_ipv4.sin_addr.s_addr == 0) || (_dest_ipv4.sin_port == 0)) |
| 227 | { |
| 228 | MTLOG_ERROR("param invalid, ip[%u], port[%u]", _dest_ipv4.sin_addr.s_addr, |
| 229 | _dest_ipv4.sin_port); |
| 230 | return RC_INVALID_PARAM; |
| 231 | } |
| 232 | |
| 233 | if (_conn_type == TYPE_CONN_SESSION) |
| 234 | { |
| 235 | if ((_callback == NULL) || (_session_id == 0)) |
| 236 | { |
| 237 | MTLOG_ERROR("param invalid, callback[%p], session_id[%llu]", _callback, _session_id); |
| 238 | return RC_INVALID_PARAM; |
| 239 | } |
| 240 | |
| 241 | if (!this->RegistSession()) |
| 242 | { |
| 243 | MTLOG_ERROR("param invalid, session_id[%llu] regist failed", _session_id); |
| 244 | return RC_CONFLICT_SID; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | int32_t CNetHandler::GetConnLink() |
| 252 | { |