Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
5a0674df
Commit
5a0674df
authored
Dec 21, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenPGM error handling improved
parent
990a1e86
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
21 deletions
+57
-21
pyzmq.cpp
bindings/python/pyzmq.cpp
+1
-1
pgm_socket.cpp
src/pgm_socket.cpp
+50
-14
pgm_socket.hpp
src/pgm_socket.hpp
+6
-6
No files found.
bindings/python/pyzmq.cpp
View file @
5a0674df
...
...
@@ -17,11 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Python.h>
#include <stddef.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <Python.h>
#include "../c/zmq.h"
...
...
src/pgm_socket.cpp
View file @
5a0674df
...
...
@@ -144,9 +144,22 @@ int zmq::pgm_socket_t::open_transport ()
struct
pgm_transport_info_t
*
res
=
NULL
;
if
(
!
pgm_if_get_transport_info
(
network
,
NULL
,
&
res
,
&
pgm_error
))
{
errno
=
EINVAL
;
g_error_free
(
pgm_error
);
return
-
1
;
if
(
pgm_error
->
code
==
PGM_IF_ERROR_INVAL
||
pgm_error
->
code
==
PGM_IF_ERROR_XDEV
||
pgm_error
->
code
==
PGM_IF_ERROR_NODEV
||
pgm_error
->
code
==
PGM_IF_ERROR_NOTUNIQ
||
pgm_error
->
code
==
PGM_IF_ERROR_ADDRFAMILY
||
pgm_error
->
code
==
PGM_IF_ERROR_FAMILY
||
pgm_error
->
code
==
PGM_IF_ERROR_NODATA
||
pgm_error
->
code
==
PGM_IF_ERROR_NONAME
||
pgm_error
->
code
==
PGM_IF_ERROR_SERVICE
)
{
errno
=
EINVAL
;
g_error_free
(
pgm_error
);
return
-
1
;
}
zmq_assert
(
false
);
}
res
->
ti_gsi
=
gsi
;
...
...
@@ -159,11 +172,16 @@ int zmq::pgm_socket_t::open_transport ()
}
if
(
!
pgm_transport_create
(
&
transport
,
res
,
&
pgm_error
))
{
pgm_if_free_transport_info
(
res
);
// TODO: tranlate errors from glib into errnos.
errno
=
EINVAL
;
g_error_free
(
pgm_error
);
return
-
1
;
if
(
pgm_error
->
code
==
PGM_TRANSPORT_ERROR_INVAL
||
pgm_error
->
code
==
PGM_TRANSPORT_ERROR_PERM
||
pgm_error
->
code
==
PGM_TRANSPORT_ERROR_NODEV
)
{
pgm_if_free_transport_info
(
res
);
g_error_free
(
pgm_error
);
errno
=
EINVAL
;
return
-
1
;
}
zmq_assert
(
false
);
}
pgm_if_free_transport_info
(
res
);
...
...
@@ -316,10 +334,21 @@ int zmq::pgm_socket_t::open_transport ()
// Bind a transport to the specified network devices.
if
(
!
pgm_transport_bind
(
transport
,
&
pgm_error
))
{
// TODO: tranlate errors from glib into errnos.
errno
=
EINVAL
;
g_error_free
(
pgm_error
);
return
-
1
;
if
(
pgm_error
->
code
==
PGM_IF_ERROR_INVAL
||
pgm_error
->
code
==
PGM_IF_ERROR_XDEV
||
pgm_error
->
code
==
PGM_IF_ERROR_NODEV
||
pgm_error
->
code
==
PGM_IF_ERROR_NOTUNIQ
||
pgm_error
->
code
==
PGM_IF_ERROR_ADDRFAMILY
||
pgm_error
->
code
==
PGM_IF_ERROR_FAMILY
||
pgm_error
->
code
==
PGM_IF_ERROR_NODATA
||
pgm_error
->
code
==
PGM_IF_ERROR_NONAME
||
pgm_error
->
code
==
PGM_IF_ERROR_SERVICE
)
{
g_error_free
(
pgm_error
);
errno
=
EINVAL
;
return
-
1
;
}
zmq_assert
(
false
);
}
return
0
;
...
...
@@ -492,7 +521,11 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
const
PGMIOStatus
status
=
pgm_recvmsgv
(
transport
,
pgm_msgv
,
pgm_msgv_len
,
MSG_DONTWAIT
,
&
nbytes_rec
,
&
pgm_error
);
if
(
status
==
PGM_IO_STATUS_ERROR
)
{
zmq_assert
(
false
);
}
// In a case when no ODATA/RDATA fired POLLIN event (SPM...)
// pgm_recvmsg returns ?.
if
(
status
==
PGM_IO_STATUS_TIMER_PENDING
)
{
...
...
@@ -520,7 +553,6 @@ ssize_t zmq::pgm_socket_t::receive (void **raw_data_, const pgm_tsi_t **tsi_)
return
-
1
;
}
// Catch the rest of the errors.
zmq_assert
(
status
==
PGM_IO_STATUS_NORMAL
);
}
...
...
@@ -556,6 +588,10 @@ void zmq::pgm_socket_t::process_upstream ()
PGMIOStatus
status
=
pgm_recvmsgv
(
transport
,
&
dummy_msg
,
1
,
MSG_DONTWAIT
,
&
dummy_bytes
,
&
pgm_error
);
if
(
status
==
PGM_IO_STATUS_ERROR
)
{
zmq_assert
(
false
);
}
// No data should be returned.
zmq_assert
(
dummy_bytes
==
0
&&
(
status
==
PGM_IO_STATUS_TIMER_PENDING
||
status
==
PGM_IO_STATUS_RATE_LIMITED
));
...
...
src/pgm_socket.hpp
View file @
5a0674df
...
...
@@ -50,12 +50,6 @@ namespace zmq
// Initialize PGM network structures (GSI, GSRs).
int
init
(
bool
udp_encapsulation_
,
const
char
*
network_
);
// Open PGM transport. Parameters are the same as in constructor.
int
open_transport
();
// Close transport.
void
close_transport
();
// Get receiver fds and store them into user allocated memory.
void
get_receiver_fds
(
int
*
receive_fd_
,
int
*
waiting_pipe_fd_
);
...
...
@@ -82,6 +76,12 @@ namespace zmq
void
process_upstream
();
private
:
// Open PGM transport.
int
open_transport
();
// Close transport.
void
close_transport
();
// OpenPGM transport
pgm_transport_t
*
transport
;
...
...
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