MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sal_check_netdev_internet_up

Function sal_check_netdev_internet_up

components/net/sal/src/sal_socket.c:321–341  ·  view source on GitHub ↗

* This function will check SAL network interface device internet status. * * @param netdev the network interface device to check */

Source from the content-addressed store, hash-verified

319 * @param netdev the network interface device to check
320 */
321int sal_check_netdev_internet_up(struct netdev *netdev)
322{
323 RT_ASSERT(netdev);
324
325#ifdef SAL_INTERNET_CHECK
326 /* workqueue for network connect */
327 struct rt_work *net_work = RT_NULL;
328
329
330 net_work = (struct rt_work *)rt_calloc(1, sizeof(struct rt_work));
331 if (net_work == RT_NULL)
332 {
333 LOG_W("No memory for network interface device(%s) delay work.", netdev->name);
334 return -1;
335 }
336
337 rt_work_init(net_work, check_netdev_internet_up_work, (void *)netdev);
338 rt_work_submit(net_work, RT_TICK_PER_SECOND);
339#endif /* SAL_INTERNET_CHECK */
340 return 0;
341}
342
343/**
344 * This function will register TLS protocol to the global TLS protocol.

Calls 3

rt_callocFunction · 0.85
rt_work_initFunction · 0.85
rt_work_submitFunction · 0.85

Tested by

no test coverage detected