Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
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
cpp-libs
Actor Framework
Commits
71416e36
Commit
71416e36
authored
Dec 29, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed native_socket_t to native_socket_type
parent
3aa024f6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
43 additions
and
41 deletions
+43
-41
cppa/detail/buffer.hpp
cppa/detail/buffer.hpp
+1
-1
cppa/detail/mailman.hpp
cppa/detail/mailman.hpp
+3
-3
cppa/detail/native_socket.hpp
cppa/detail/native_socket.hpp
+5
-3
cppa/detail/post_office.hpp
cppa/detail/post_office.hpp
+3
-3
cppa/detail/post_office_msg.hpp
cppa/detail/post_office_msg.hpp
+6
-6
src/mailman.cpp
src/mailman.cpp
+2
-2
src/native_socket.cpp
src/native_socket.cpp
+1
-1
src/post_office.cpp
src/post_office.cpp
+11
-11
src/post_office_msg.cpp
src/post_office_msg.cpp
+4
-4
src/unicast_network.cpp
src/unicast_network.cpp
+7
-7
No files found.
cppa/detail/buffer.hpp
View file @
71416e36
...
...
@@ -154,7 +154,7 @@ class buffer
return
append_impl
(
fun
,
throw_on_error
);
}
bool
append_from
(
native_socket_t
sfd
,
int
rdflags
,
bool
append_from
(
native_socket_t
ype
sfd
,
int
rdflags
,
bool
throw_on_error
=
false
)
{
auto
_this
=
this
;
...
...
cppa/detail/mailman.hpp
View file @
71416e36
...
...
@@ -25,9 +25,9 @@ struct mailman_send_job
struct
mailman_add_peer
{
native_socket_t
sockfd
;
native_socket_t
ype
sockfd
;
process_information_ptr
pinfo
;
inline
mailman_add_peer
(
native_socket_t
fd
,
inline
mailman_add_peer
(
native_socket_t
ype
fd
,
const
process_information_ptr
&
piptr
)
:
sockfd
(
fd
),
pinfo
(
piptr
)
{
...
...
@@ -53,7 +53,7 @@ class mailman_job
const
channel_ptr
&
to
,
const
any_tuple
&
omsg
);
mailman_job
(
native_socket_t
sockfd
,
const
process_information_ptr
&
pinfo
);
mailman_job
(
native_socket_t
ype
sockfd
,
const
process_information_ptr
&
pinfo
);
static
mailman_job
*
kill_job
();
...
...
cppa/detail/native_socket.hpp
View file @
71416e36
...
...
@@ -15,14 +15,16 @@
namespace
cppa
{
namespace
detail
{
#ifdef CPPA_WINDOWS
typedef
SOCKET
native_socket_t
;
typedef
SOCKET
native_socket_t
ype
;
typedef
const
char
*
socket_send_ptr
;
typedef
char
*
socket_recv_ptr
;
constexpr
SOCKET
invalid_socket
=
INVALID_SOCKET
;
#else
typedef
int
native_socket_t
;
typedef
int
native_socket_t
ype
;
typedef
const
void
*
socket_send_ptr
;
typedef
void
*
socket_recv_ptr
;
void
closesocket
(
native_socket_t
s
);
constexpr
int
invalid_socket
=
-
1
;
void
closesocket
(
native_socket_type
s
);
#endif
}
}
// namespace cppa::detail
...
...
cppa/detail/post_office.hpp
View file @
71416e36
...
...
@@ -10,17 +10,17 @@ namespace cppa { namespace detail {
void
post_office_loop
(
int
pipe_read_handle
,
int
pipe_write_handle
);
void
post_office_add_peer
(
native_socket_t
peer_socket
,
void
post_office_add_peer
(
native_socket_t
ype
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
void
post_office_publish
(
native_socket_t
server_socket
,
void
post_office_publish
(
native_socket_t
ype
server_socket
,
const
actor_ptr
&
published_actor
);
void
post_office_unpublish
(
actor_id
whom
);
void
post_office_close_socket
(
native_socket_t
sfd
);
void
post_office_close_socket
(
native_socket_t
ype
sfd
);
}
}
// namespace cppa::detail
...
...
cppa/detail/post_office_msg.hpp
View file @
71416e36
...
...
@@ -27,12 +27,12 @@ class post_office_msg
struct
add_peer
{
native_socket_t
sockfd
;
native_socket_t
ype
sockfd
;
process_information_ptr
peer
;
actor_proxy_ptr
first_peer_actor
;
std
::
unique_ptr
<
attachable
>
attachable_ptr
;
add_peer
(
native_socket_t
peer_socket
,
add_peer
(
native_socket_t
ype
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
);
...
...
@@ -42,10 +42,10 @@ class post_office_msg
struct
add_server_socket
{
native_socket_t
server_sockfd
;
native_socket_t
ype
server_sockfd
;
actor_ptr
published_actor
;
add_server_socket
(
native_socket_t
ssockfd
,
const
actor_ptr
&
whom
);
add_server_socket
(
native_socket_t
ype
ssockfd
,
const
actor_ptr
&
whom
);
};
...
...
@@ -55,12 +55,12 @@ class post_office_msg
inline
proxy_exited
(
const
actor_proxy_ptr
&
who
)
:
proxy_ptr
(
who
)
{
}
};
post_office_msg
(
native_socket_t
arg0
,
post_office_msg
(
native_socket_t
ype
arg0
,
const
process_information_ptr
&
arg1
,
const
actor_proxy_ptr
&
arg2
,
std
::
unique_ptr
<
attachable
>&&
arg3
);
post_office_msg
(
native_socket_t
arg0
,
const
actor_ptr
&
arg1
);
post_office_msg
(
native_socket_t
ype
arg0
,
const
actor_ptr
&
arg1
);
post_office_msg
(
const
actor_proxy_ptr
&
proxy_ptr
);
...
...
src/mailman.cpp
View file @
71416e36
...
...
@@ -21,7 +21,7 @@ mailman_job::mailman_job(process_information_ptr piptr,
new
(
&
m_send_job
)
mailman_send_job
(
piptr
,
from
,
to
,
content
);
}
mailman_job
::
mailman_job
(
native_socket_t
sockfd
,
const
process_information_ptr
&
pinfo
)
mailman_job
::
mailman_job
(
native_socket_t
ype
sockfd
,
const
process_information_ptr
&
pinfo
)
:
next
(
0
),
m_type
(
add_peer_type
)
{
new
(
&
m_add_socket
)
mailman_add_peer
(
sockfd
,
pinfo
);
...
...
@@ -69,7 +69,7 @@ void mailman_loop()
// caches mailman_queue()
auto
&
mqueue
=
mailman_queue
();
// connected tcp peers
std
::
map
<
process_information
,
native_socket_t
>
peers
;
std
::
map
<
process_information
,
native_socket_t
ype
>
peers
;
for
(;;)
{
job
=
mqueue
.
pop
();
...
...
src/native_socket.cpp
View file @
71416e36
...
...
@@ -9,7 +9,7 @@ namespace cppa { namespace detail {
#ifndef CPPA_WINDOWS
void
closesocket
(
native_socket_t
s
)
void
closesocket
(
native_socket_t
ype
s
)
{
if
(
::
close
(
s
)
!=
0
)
{
...
...
src/post_office.cpp
View file @
71416e36
...
...
@@ -61,7 +61,7 @@ constexpr size_t s_max_buffer_size = (1024 * 1024);
static_assert
((
s_max_buffer_size
%
s_chunk_size
)
==
0
,
"max_buffer_size is not a multiple of chunk_size"
);
static_assert
(
sizeof
(
cppa
::
detail
::
native_socket_t
)
==
sizeof
(
std
::
uint32_t
),
static_assert
(
sizeof
(
cppa
::
detail
::
native_socket_t
ype
)
==
sizeof
(
std
::
uint32_t
),
"sizeof(native_socket_t) != sizeof(std::uint32_t)"
);
constexpr
int
s_rdflag
=
MSG_DONTWAIT
;
...
...
@@ -93,9 +93,9 @@ class po_peer
state
m_state
;
// TCP socket to remote peer
native_socket_t
m_socket
;
native_socket_t
ype
m_socket
;
// TCP socket identifying our parent (that accepted m_socket)
native_socket_t
m_parent_socket
;
native_socket_t
ype
m_parent_socket
;
// caches process_information::get()
process_information_ptr
m_pself
;
// the process information or our remote peer
...
...
@@ -119,7 +119,7 @@ class po_peer
{
}
explicit
po_peer
(
native_socket_t
sockfd
,
native_socket_t
parent_socket
)
explicit
po_peer
(
native_socket_t
ype
sockfd
,
native_socket_type
parent_socket
)
:
m_state
(
wait_for_process_info
)
,
m_socket
(
sockfd
)
,
m_parent_socket
(
parent_socket
)
...
...
@@ -146,7 +146,7 @@ class po_peer
// other.m_children.clear();
}
native_socket_t
get_socket
()
const
native_socket_t
ype
get_socket
()
const
{
return
m_socket
;
}
...
...
@@ -344,7 +344,7 @@ class po_doorman
{
// server socket
native_socket_t
m_socket
;
native_socket_t
ype
m_socket
;
actor_ptr
published_actor
;
std
::
list
<
po_peer
>*
m_peers
;
// caches process_information::get()
...
...
@@ -375,7 +375,7 @@ class po_doorman
other
.
m_socket
=
-
1
;
}
inline
native_socket_t
get_socket
()
const
inline
native_socket_t
ype
get_socket
()
const
{
return
m_socket
;
}
...
...
@@ -639,7 +639,7 @@ void post_office_loop(int pipe_read_handle, int pipe_write_handle)
case
close_socket_event
:
{
DEBUG
(
"close_socket_event"
);
auto
sockfd
=
static_cast
<
native_socket_t
>
(
pmsg
[
1
]);
auto
sockfd
=
static_cast
<
native_socket_t
ype
>
(
pmsg
[
1
]);
auto
end
=
peers
.
end
();
auto
i
=
std
::
find_if
(
peers
.
begin
(),
end
,
[
sockfd
](
po_peer
&
peer
)
->
bool
...
...
@@ -691,7 +691,7 @@ void post_office_loop(int pipe_read_handle, int pipe_write_handle)
* (forward each function call to our queue) *
******************************************************************************/
void
post_office_add_peer
(
native_socket_t
a0
,
void
post_office_add_peer
(
native_socket_t
ype
a0
,
const
process_information_ptr
&
a1
,
const
actor_proxy_ptr
&
a2
,
std
::
unique_ptr
<
attachable
>&&
a3
)
...
...
@@ -703,7 +703,7 @@ void post_office_add_peer(native_socket_t a0,
write
(
nm
->
write_handle
(),
msg
,
pipe_msg_size
);
}
void
post_office_publish
(
native_socket_t
server_socket
,
void
post_office_publish
(
native_socket_t
ype
server_socket
,
const
actor_ptr
&
published_actor
)
{
DEBUG
(
"post_office_publish("
<<
published_actor
->
id
()
<<
")"
);
...
...
@@ -722,7 +722,7 @@ void post_office_unpublish(actor_id whom)
write
(
nm
->
write_handle
(),
msg
,
pipe_msg_size
);
}
void
post_office_close_socket
(
native_socket_t
sfd
)
void
post_office_close_socket
(
native_socket_t
ype
sfd
)
{
auto
nm
=
singleton_manager
::
get_network_manager
();
pipe_msg
msg
=
{
close_socket_event
,
static_cast
<
std
::
uint32_t
>
(
sfd
)
};
...
...
src/post_office_msg.cpp
View file @
71416e36
...
...
@@ -2,7 +2,7 @@
namespace
cppa
{
namespace
detail
{
post_office_msg
::
add_peer
::
add_peer
(
native_socket_t
peer_socket
,
post_office_msg
::
add_peer
::
add_peer
(
native_socket_t
ype
peer_socket
,
const
process_information_ptr
&
peer_ptr
,
const
actor_proxy_ptr
&
peer_actor_ptr
,
std
::
unique_ptr
<
attachable
>&&
peer_observer
)
...
...
@@ -13,14 +13,14 @@ post_office_msg::add_peer::add_peer(native_socket_t peer_socket,
{
}
post_office_msg
::
add_server_socket
::
add_server_socket
(
native_socket_t
ssockfd
,
post_office_msg
::
add_server_socket
::
add_server_socket
(
native_socket_t
ype
ssockfd
,
const
actor_ptr
&
whom
)
:
server_sockfd
(
ssockfd
)
,
published_actor
(
whom
)
{
}
post_office_msg
::
post_office_msg
(
native_socket_t
arg0
,
post_office_msg
::
post_office_msg
(
native_socket_t
ype
arg0
,
const
process_information_ptr
&
arg1
,
const
actor_proxy_ptr
&
arg2
,
std
::
unique_ptr
<
attachable
>&&
arg3
)
...
...
@@ -30,7 +30,7 @@ post_office_msg::post_office_msg(native_socket_t arg0,
new
(
&
m_add_peer_msg
)
add_peer
(
arg0
,
arg1
,
arg2
,
std
::
move
(
arg3
));
}
post_office_msg
::
post_office_msg
(
native_socket_t
arg0
,
const
actor_ptr
&
arg1
)
post_office_msg
::
post_office_msg
(
native_socket_t
ype
arg0
,
const
actor_ptr
&
arg1
)
:
next
(
nullptr
)
,
m_type
(
add_server_socket_type
)
{
...
...
src/unicast_network.cpp
View file @
71416e36
...
...
@@ -31,7 +31,7 @@ namespace cppa {
namespace
{
void
read_from_socket
(
detail
::
native_socket_t
sfd
,
void
*
buf
,
size_t
buf_size
)
void
read_from_socket
(
detail
::
native_socket_t
ype
sfd
,
void
*
buf
,
size_t
buf_size
)
{
char
*
cbuf
=
reinterpret_cast
<
char
*>
(
buf
);
size_t
read_bytes
=
0
;
...
...
@@ -58,11 +58,11 @@ struct socket_guard
{
bool
m_released
;
detail
::
native_socket_t
m_socket
;
detail
::
native_socket_t
ype
m_socket
;
public:
socket_guard
(
detail
::
native_socket_t
sfd
)
:
m_released
(
false
),
m_socket
(
sfd
)
socket_guard
(
detail
::
native_socket_t
ype
sfd
)
:
m_released
(
false
),
m_socket
(
sfd
)
{
}
...
...
@@ -81,10 +81,10 @@ struct socket_guard
void
publish
(
actor_ptr
&
whom
,
std
::
uint16_t
port
)
{
if
(
!
whom
)
return
;
detail
::
native_socket_t
sockfd
;
detail
::
native_socket_t
ype
sockfd
;
struct
sockaddr_in
serv_addr
;
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
<
0
)
if
(
sockfd
==
detail
::
invalid_socket
)
{
throw
network_error
(
"could not create server socket"
);
}
...
...
@@ -123,11 +123,11 @@ void publish(actor_ptr&& whom, std::uint16_t port)
actor_ptr
remote_actor
(
const
char
*
host
,
std
::
uint16_t
port
)
{
detail
::
native_socket_t
sockfd
;
detail
::
native_socket_t
ype
sockfd
;
struct
sockaddr_in
serv_addr
;
struct
hostent
*
server
;
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
<
0
)
if
(
sockfd
==
detail
::
invalid_socket
)
{
throw
network_error
(
"socket creation failed"
);
}
...
...
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