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
aef2171e
Commit
aef2171e
authored
Jun 29, 2013
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make last_endpoint attribute of socket object
parent
fd7e9b8c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
16 deletions
+18
-16
options.cpp
src/options.cpp
+0
-8
options.hpp
src/options.hpp
+0
-3
socket_base.cpp
src/socket_base.cpp
+15
-5
socket_base.hpp
src/socket_base.hpp
+3
-0
No files found.
src/options.cpp
View file @
aef2171e
...
...
@@ -501,14 +501,6 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break
;
case
ZMQ_LAST_ENDPOINT
:
if
(
*
optvallen_
>=
last_endpoint
.
size
()
+
1
)
{
memcpy
(
optval_
,
last_endpoint
.
c_str
(),
last_endpoint
.
size
()
+
1
);
*
optvallen_
=
last_endpoint
.
size
()
+
1
;
return
0
;
}
break
;
case
ZMQ_MECHANISM
:
if
(
is_int
)
{
*
value
=
mechanism
;
...
...
src/options.hpp
View file @
aef2171e
...
...
@@ -50,9 +50,6 @@ namespace zmq
unsigned
char
identity_size
;
unsigned
char
identity
[
256
];
// Last socket endpoint resolved URI
std
::
string
last_endpoint
;
// Maximum tranfer rate [kb/s]. Default 100kb/s.
int
rate
;
...
...
src/socket_base.cpp
View file @
aef2171e
...
...
@@ -302,6 +302,16 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
return
0
;
}
if
(
option_
==
ZMQ_LAST_ENDPOINT
)
{
if
(
*
optvallen_
<
last_endpoint
.
size
()
+
1
)
{
errno
=
EINVAL
;
return
-
1
;
}
strcpy
(
static_cast
<
char
*>
(
optval_
),
last_endpoint
.
c_str
());
*
optvallen_
=
last_endpoint
.
size
()
+
1
;
return
0
;
}
return
options
.
getsockopt
(
option_
,
optval_
,
optvallen_
);
}
...
...
@@ -333,7 +343,7 @@ int zmq::socket_base_t::bind (const char *addr_)
int
rc
=
register_endpoint
(
addr_
,
endpoint
);
if
(
rc
==
0
)
{
// Save last endpoint URI
options
.
last_endpoint
.
assign
(
addr_
);
last_endpoint
.
assign
(
addr_
);
}
return
rc
;
}
...
...
@@ -364,7 +374,7 @@ int zmq::socket_base_t::bind (const char *addr_)
}
// Save last endpoint URI
listener
->
get_address
(
options
.
last_endpoint
);
listener
->
get_address
(
last_endpoint
);
add_endpoint
(
addr_
,
(
own_t
*
)
listener
);
return
0
;
...
...
@@ -383,7 +393,7 @@ int zmq::socket_base_t::bind (const char *addr_)
}
// Save last endpoint URI
listener
->
get_address
(
options
.
last_endpoint
);
listener
->
get_address
(
last_endpoint
);
add_endpoint
(
addr_
,
(
own_t
*
)
listener
);
return
0
;
...
...
@@ -478,7 +488,7 @@ int zmq::socket_base_t::connect (const char *addr_)
send_bind
(
peer
.
socket
,
new_pipes
[
1
],
false
);
// Save last endpoint URI
options
.
last_endpoint
.
assign
(
addr_
);
last_endpoint
.
assign
(
addr_
);
// remember inproc connections for disconnect
inprocs
.
insert
(
inprocs_t
::
value_type
(
std
::
string
(
addr_
),
new_pipes
[
0
]));
...
...
@@ -556,7 +566,7 @@ int zmq::socket_base_t::connect (const char *addr_)
}
// Save last endpoint URI
paddr
->
to_string
(
options
.
last_endpoint
);
paddr
->
to_string
(
last_endpoint
);
add_endpoint
(
addr_
,
(
own_t
*
)
session
);
return
0
;
...
...
src/socket_base.hpp
View file @
aef2171e
...
...
@@ -238,6 +238,9 @@ namespace zmq
// Bitmask of events being monitored
int
monitor_events
;
// Last socket endpoint resolved URI
std
::
string
last_endpoint
;
socket_base_t
(
const
socket_base_t
&
);
const
socket_base_t
&
operator
=
(
const
socket_base_t
&
);
mutex_t
sync
;
...
...
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