Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions components/net/at/at_socket/at_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,16 +751,22 @@ static void at_connect_notice_cb(struct at_socket *sock, at_socket_evt_t event,
char *socket_info = RT_NULL;
int base_socket = 0;

rt_sscanf(buff, "SOCKET:%d", &base_socket);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接读取缓冲区是没法兼容很多AT设备的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我只是把下面的 往前提了一下 ,您说的应该是当前组件的问题 ,不是我新引入的问题

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哦哦,那应该没什么问题。 我看目前也就esp适配了at_server接口,可以先合并进去。

LOG_D("ACCEPT BASE SOCKET: %d", base_socket);
/* avoid use bottom driver to alloc "socket" */
new_sock = at_get_base_socket(base_socket);
if (new_sock)
{
new_sock->state = AT_SOCKET_CONNECT;
return;
}
new_socket = at_socket(AF_AT, SOCK_STREAM, 0);
if (new_socket == -1)
{
return;
}
new_sock = at_get_socket(new_socket);
new_sock->state = AT_SOCKET_CONNECT;
rt_sscanf(buff, "SOCKET:%d", &base_socket);
LOG_D("ACCEPT BASE SOCKET: %d", base_socket);
new_sock->user_data = (void *)base_socket;

/* find out the listen socket */
Expand Down Expand Up @@ -995,6 +1001,7 @@ int at_accept(int socket, struct sockaddr *name, socklen_t *namelen)
if (result < 0)
{
at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE);
return result;
}

return new_sock->socket;
Expand Down