Fix TCP/IP udp support.
Change-Id: I819c54e13b5198d11b9e526e8eb2ca8bccc069f8
diff --git a/mbtk/mbtk_lib/src/mbtk_sock2.c b/mbtk/mbtk_lib/src/mbtk_sock2.c
index f9f6b6b..a843d6b 100755
--- a/mbtk/mbtk_lib/src/mbtk_sock2.c
+++ b/mbtk/mbtk_lib/src/mbtk_sock2.c
@@ -145,13 +145,17 @@
int index = sock_info_find_by_fd(handle,epoll_events[i].data.fd);
if(index >= 0 && mbtk_sock[handle]->init_info.sock_cb != NULL) {
mbtk_sock_inter_info_s *inter_info = &(mbtk_sock[handle]->inter_infos[index]);
+ mbtk_sock_info *info = &(mbtk_sock[handle]->infos[index]);
//if(sock_is_close(epoll_events[i].data.fd)) {
// LOGE("Socket %d is closed.",epoll_events[i].data.fd);
// break;
//}
-
- mbtk_sock[handle]->init_info.sock_cb(handle,inter_info->fd,epoll_events[i].events);
+ mbtk_sock_cb_info_s sock_info;
+ sock_info.sock_fd = inter_info->fd;
+ sock_info.event = epoll_events[i].events;
+ sock_info.sock_type = info->type;
+ mbtk_sock[handle]->init_info.sock_cb(handle, &sock_info);
if(epoll_events[i].events & EPOLLERR){ // error[ UDP server can't use.]
LOGD("%d EPOLLERR.",epoll_events[i].data.fd);
@@ -208,8 +212,11 @@
while(handle < MBTK_HANDLE_MAX_NUM) {
if(mbtk_sock[handle] != NULL) {
if(mbtk_sock[handle]->init_info.net_cb != NULL) {
- mbtk_sock[handle]->init_info.net_cb(handle, (addr_info->type == MBTK_NET_ADDR_CHANGE_TYPE_ADD) ? 1 : 0,
- addr_info->addr, addr_info->if_name);
+ mbtk_net_cb_info_s net_info;
+ net_info.state = (addr_info->type == MBTK_NET_ADDR_CHANGE_TYPE_ADD) ? 1 : 0;
+ net_info.addr = addr_info->addr;
+ net_info.if_name = addr_info->if_name;
+ mbtk_sock[handle]->init_info.net_cb(handle, &net_info);
}
}