Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f11c40d8
提交
f11c40d8
authored
7月 23, 2014
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-6680 #resolve
上级
03c4014d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
5 行增加
和
22 行删除
+5
-22
switch_nat.c
src/switch_nat.c
+5
-22
没有找到文件。
src/switch_nat.c
浏览文件 @
f11c40d8
...
@@ -151,11 +151,7 @@ static int get_pmp_pubaddr(char *pub_addr)
...
@@ -151,11 +151,7 @@ static int get_pmp_pubaddr(char *pub_addr)
char
*
pubaddr
=
NULL
;
char
*
pubaddr
=
NULL
;
natpmp_t
natpmp
;
natpmp_t
natpmp
;
const
char
*
err
=
NULL
;
const
char
*
err
=
NULL
;
switch_pollfd_t
*
pollfd
=
NULL
;
int
pflags
;
switch_socket_t
*
sock
=
NULL
;
switch_memory_pool_t
*
pool
;
int32_t
num
=
0
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
if
((
r
=
initnatpmp
(
&
natpmp
))
<
0
)
{
if
((
r
=
initnatpmp
(
&
natpmp
))
<
0
)
{
err
=
"init failed"
;
err
=
"init failed"
;
...
@@ -167,15 +163,6 @@ static int get_pmp_pubaddr(char *pub_addr)
...
@@ -167,15 +163,6 @@ static int get_pmp_pubaddr(char *pub_addr)
goto
end
;
goto
end
;
}
}
switch_core_new_memory_pool
(
&
pool
);
switch_os_sock_put
(
&
sock
,
&
natpmp
.
s
,
pool
);
if
(
switch_socket_create_pollset
(
&
pollfd
,
sock
,
SWITCH_POLLIN
|
SWITCH_POLLERR
,
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
err
=
"cannot create pollset"
;
goto
end
;
}
do
{
do
{
struct
timeval
timeout
=
{
1
,
0
};
struct
timeval
timeout
=
{
1
,
0
};
i
++
;
i
++
;
...
@@ -185,16 +172,14 @@ static int get_pmp_pubaddr(char *pub_addr)
...
@@ -185,16 +172,14 @@ static int get_pmp_pubaddr(char *pub_addr)
err
=
"get timeout failed"
;
err
=
"get timeout failed"
;
goto
end
;
goto
end
;
}
}
status
=
switch_poll
(
pollfd
,
1
,
&
num
,
switch_interval_time_from_timeval
(
&
timeout
));
if
(
!
(
status
==
SWITCH_STATUS_SUCCESS
||
status
==
SWITCH_STATUS_TIMEOUT
))
{
pflags
=
switch_wait_sock
(
natpmp
.
s
,
100
,
SWITCH_POLL_READ
|
SWITCH_POLL_ERROR
|
SWITCH_POLL_HUP
);
err
=
"poll failed"
;
if
((
pflags
&
SWITCH_POLL_ERROR
)
||
(
pflags
&
SWITCH_POLL_HUP
))
{
err
=
"wait sock failed"
;
goto
end
;
goto
end
;
}
}
r
=
readnatpmpresponseorretry
(
&
natpmp
,
&
response
);
r
=
readnatpmpresponseorretry
(
&
natpmp
,
&
response
);
}
while
(
r
==
NATPMP_TRYAGAIN
&&
i
<
max
);
}
while
(
r
==
NATPMP_TRYAGAIN
&&
i
<
max
);
if
(
r
<
0
)
{
if
(
r
<
0
)
{
...
@@ -210,8 +195,6 @@ static int get_pmp_pubaddr(char *pub_addr)
...
@@ -210,8 +195,6 @@ static int get_pmp_pubaddr(char *pub_addr)
end:
end:
switch_core_destroy_memory_pool
(
&
pool
);
if
(
err
)
{
if
(
err
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error checking for PMP [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error checking for PMP [%s]
\n
"
,
err
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论