Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
6039152c
Commit
6039152c
authored
Oct 29, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use WSAGetLastError instead of errno
parent
ddd7c552
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
9 deletions
+41
-9
socket/tcp-turn.c
socket/tcp-turn.c
+30
-6
stun/tests/test-turn.c
stun/tests/test-turn.c
+4
-1
stun/usages/trans.c
stun/usages/trans.c
+7
-2
No files found.
socket/tcp-turn.c
View file @
6039152c
...
@@ -54,10 +54,6 @@
...
@@ -54,10 +54,6 @@
#include "tcp-turn.h"
#include "tcp-turn.h"
#ifdef G_OS_WIN32
#define EINPROGRESS WSAEINPROGRESS
#endif
typedef
struct
{
typedef
struct
{
NiceUdpTurnSocketCompatibility
compatibility
;
NiceUdpTurnSocketCompatibility
compatibility
;
GQueue
send_queue
;
GQueue
send_queue
;
...
@@ -101,7 +97,11 @@ socket_recv (
...
@@ -101,7 +97,11 @@ socket_recv (
ret
=
read
(
sock
->
fileno
,
priv
->
recv_buf
+
priv
->
recv_buf_len
,
ret
=
read
(
sock
->
fileno
,
priv
->
recv_buf
+
priv
->
recv_buf_len
,
headerlen
-
priv
->
recv_buf_len
);
headerlen
-
priv
->
recv_buf_len
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
#else
if
(
errno
==
EAGAIN
)
if
(
errno
==
EAGAIN
)
#endif
return
0
;
return
0
;
else
else
return
ret
;
return
ret
;
...
@@ -139,7 +139,11 @@ socket_recv (
...
@@ -139,7 +139,11 @@ socket_recv (
ret
=
read
(
sock
->
fileno
,
priv
->
recv_buf
+
priv
->
recv_buf_len
,
ret
=
read
(
sock
->
fileno
,
priv
->
recv_buf
+
priv
->
recv_buf_len
,
priv
->
expecting_len
+
padlen
-
priv
->
recv_buf_len
);
priv
->
expecting_len
+
padlen
-
priv
->
recv_buf_len
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
#else
if
(
errno
==
EAGAIN
)
if
(
errno
==
EAGAIN
)
#endif
return
0
;
return
0
;
else
else
return
ret
;
return
ret
;
...
@@ -188,7 +192,11 @@ socket_send_more (
...
@@ -188,7 +192,11 @@ socket_send_more (
ret
=
write
(
sock
->
fileno
,
tbs
->
buf
,
tbs
->
length
);
ret
=
write
(
sock
->
fileno
,
tbs
->
buf
,
tbs
->
length
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
{
#else
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
#endif
add_to_be_sent
(
sock
,
tbs
->
buf
,
tbs
->
length
,
TRUE
);
add_to_be_sent
(
sock
,
tbs
->
buf
,
tbs
->
length
,
TRUE
);
g_free
(
tbs
->
buf
);
g_free
(
tbs
->
buf
);
g_slice_free
(
struct
to_be_sent
,
tbs
);
g_slice_free
(
struct
to_be_sent
,
tbs
);
...
@@ -267,15 +275,19 @@ socket_send (
...
@@ -267,15 +275,19 @@ socket_send (
ret
=
write
(
sock
->
fileno
,
&
tmpbuf
,
sizeof
(
guint16
));
ret
=
write
(
sock
->
fileno
,
&
tmpbuf
,
sizeof
(
guint16
));
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
{
#else
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
add_to_be_sent
(
sock
,
(
gchar
*
)
&
tmpbuf
,
sizeof
(
guint16
),
FALSE
);
#endif
add_to_be_sent
(
sock
,
(
gchar
*
)
&
tmpbuf
,
sizeof
(
guint16
),
FALSE
);
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
return
TRUE
;
return
TRUE
;
}
else
{
}
else
{
return
FALSE
;
return
FALSE
;
}
}
}
else
if
((
guint
)
ret
<
sizeof
(
guint16
))
{
}
else
if
((
guint
)
ret
<
sizeof
(
guint16
))
{
add_to_be_sent
(
sock
,
((
gchar
*
)
&
tmpbuf
)
+
ret
,
add_to_be_sent
(
sock
,
((
gchar
*
)
&
tmpbuf
)
+
ret
,
sizeof
(
guint16
)
-
ret
,
FALSE
);
sizeof
(
guint16
)
-
ret
,
FALSE
);
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
return
TRUE
;
return
TRUE
;
...
@@ -285,7 +297,11 @@ socket_send (
...
@@ -285,7 +297,11 @@ socket_send (
ret
=
write
(
sock
->
fileno
,
buf
,
len
);
ret
=
write
(
sock
->
fileno
,
buf
,
len
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
{
#else
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
#endif
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
add_to_be_sent
(
sock
,
buf
,
len
,
FALSE
);
add_to_be_sent
(
sock
,
padbuf
,
padlen
,
FALSE
);
add_to_be_sent
(
sock
,
padbuf
,
padlen
,
FALSE
);
return
TRUE
;
return
TRUE
;
...
@@ -304,7 +320,11 @@ socket_send (
...
@@ -304,7 +320,11 @@ socket_send (
ret
=
write
(
sock
->
fileno
,
padbuf
,
padlen
);
ret
=
write
(
sock
->
fileno
,
padbuf
,
padlen
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
#ifdef G_OS_WIN32
if
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
{
#else
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
#endif
add_to_be_sent
(
sock
,
padbuf
,
padlen
,
FALSE
);
add_to_be_sent
(
sock
,
padbuf
,
padlen
,
FALSE
);
return
TRUE
;
return
TRUE
;
}
else
{
}
else
{
...
@@ -400,7 +420,11 @@ nice_tcp_turn_socket_new (
...
@@ -400,7 +420,11 @@ nice_tcp_turn_socket_new (
ret
=
connect
(
sockfd
,
(
const
struct
sockaddr
*
)
&
name
,
name_len
);
ret
=
connect
(
sockfd
,
(
const
struct
sockaddr
*
)
&
name
,
name_len
);
#ifdef G_OS_WIN32
if
(
ret
<
0
&&
WSAGetLastError
()
!=
WSAEINPROGRESS
)
{
#else
if
(
ret
<
0
&&
errno
!=
EINPROGRESS
)
{
if
(
ret
<
0
&&
errno
!=
EINPROGRESS
)
{
#endif
close
(
sockfd
);
close
(
sockfd
);
g_slice_free
(
NiceSocket
,
sock
);
g_slice_free
(
NiceSocket
,
sock
);
return
NULL
;
return
NULL
;
...
...
stun/tests/test-turn.c
View file @
6039152c
...
@@ -165,8 +165,11 @@ static void numb (void)
...
@@ -165,8 +165,11 @@ static void numb (void)
assert
(
fd
!=
-
1
);
assert
(
fd
!=
-
1
);
val
=
connect
(
fd
,
res
->
ai_addr
,
res
->
ai_addrlen
);
val
=
connect
(
fd
,
res
->
ai_addr
,
res
->
ai_addrlen
);
#ifdef G_OS_WIN32
assert
(
val
==
0
||
(
WSAGetLastError
()
==
WSAEINPROGRESS
));
#else
assert
(
val
==
0
||
(
errno
==
EINPROGRESS
));
assert
(
val
==
0
||
(
errno
==
EINPROGRESS
));
#endif
memset
(
&
hints
,
0
,
sizeof
(
hints
));
memset
(
&
hints
,
0
,
sizeof
(
hints
));
hints
.
ai_family
=
AF_UNSPEC
;
hints
.
ai_family
=
AF_UNSPEC
;
...
...
stun/usages/trans.c
View file @
6039152c
...
@@ -135,9 +135,14 @@ int stun_trans_create (stun_trans_t *restrict tr, int type, int proto,
...
@@ -135,9 +135,14 @@ int stun_trans_create (stun_trans_t *restrict tr, int type, int proto,
if
(
fd
==
-
1
)
if
(
fd
==
-
1
)
return
errno
;
return
errno
;
if
(
connect
(
fd
,
srv
,
srvlen
)
&&
(
errno
!=
EINPROGRESS
))
if
(
connect
(
fd
,
srv
,
srvlen
)
&&
{
#ifdef _WIN32
(
WSAGetLastError
()
!=
WSAEINPROGRESS
))
{
val
=
WSAGetLastError
();
#else
(
errno
!=
EINPROGRESS
))
{
val
=
errno
;
val
=
errno
;
#endif
goto
error
;
goto
error
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment