Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
4c9b69da
Commit
4c9b69da
authored
May 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gnutls: provide custom a writev callback to prevent SIGPIPE
parent
8c33da5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
modules/misc/gnutls.c
modules/misc/gnutls.c
+33
-1
No files found.
modules/misc/gnutls.c
View file @
4c9b69da
...
...
@@ -22,6 +22,7 @@
# include "config.h"
#endif
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
...
...
@@ -130,6 +131,35 @@ static int gnutls_Error (vlc_object_t *obj, int val)
}
#define gnutls_Error(o, val) gnutls_Error(VLC_OBJECT(o), val)
#ifdef IOV_MAX
static
ssize_t
vlc_gnutls_writev
(
gnutls_transport_ptr_t
ptr
,
const
giovec_t
*
giov
,
int
iovcnt
)
{
if
(
unlikely
((
unsigned
)
iovcnt
>
IOV_MAX
))
{
errno
=
EINVAL
;
return
-
1
;
}
if
(
unlikely
(
iovcnt
==
0
))
return
0
;
struct
iovec
iov
[
iovcnt
];
struct
msghdr
msg
=
{
.
msg_iov
=
iov
,
.
msg_iovlen
=
iovcnt
,
};
int
fd
=
(
intptr_t
)
ptr
;
for
(
int
i
=
0
;
i
<
iovcnt
;
i
++
)
{
iov
[
i
].
iov_base
=
giov
[
i
].
iov_base
;
iov
[
i
].
iov_len
=
giov
[
i
].
iov_len
;
}
return
sendmsg
(
fd
,
&
msg
,
MSG_NOSIGNAL
);
}
#endif
/**
* Sends data through a TLS session.
*/
...
...
@@ -221,7 +251,9 @@ static int gnutls_SessionOpen (vlc_tls_t *tls, int type,
}
gnutls_transport_set_int
(
session
,
fd
);
#ifdef IOV_MAX
gnutls_transport_set_vec_push_function
(
session
,
vlc_gnutls_writev
);
#endif
tls
->
sys
=
session
;
tls
->
sock
.
p_sys
=
NULL
;
tls
->
sock
.
pf_send
=
gnutls_Send
;
...
...
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