Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EtherBone Core
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
EtherBone Core
Commits
fe018e9e
Commit
fe018e9e
authored
13 years ago
by
Wesley W. Terpstra
Browse files
Options
Downloads
Patches
Plain Diff
TCP connection established ok.
parent
1b86b03c
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/format/slave.c
+8
-0
8 additions, 0 deletions
api/format/slave.c
api/transport/posix-ip.c
+9
-3
9 additions, 3 deletions
api/transport/posix-ip.c
api/transport/posix-ip.h
+2
-3
2 additions, 3 deletions
api/transport/posix-ip.h
api/transport/posix-tcp.c
+1
-6
1 addition, 6 deletions
api/transport/posix-tcp.c
with
20 additions
and
12 deletions
api/format/slave.c
+
8
−
0
View file @
fe018e9e
...
...
@@ -125,12 +125,20 @@ void eb_device_slave(eb_socket_t socketp, eb_transport_t transportp, eb_device_t
/* < 8: protocol violation! */
if
(
active
)
goto
kill
;
/* active link not probed! */
widths
=
buffer
[
3
];
widths
=
eb_width_refine
(
widths
&
socket
->
widths
);
buffer
[
2
]
=
0x12
;
/* V1 probe response */
buffer
[
3
]
=
socket
->
widths
;
/* passive and transport both use socket widths */
if
(
passive
)
device
->
widths
=
widths
;
/* This will be the negotiated width */
/* Bytes 4-7 are echoed back */
eb_transports
[
transport
->
link_type
].
send
(
transport
,
link
,
buffer
,
8
);
/* Kill the link if negotiation is impossible */
if
(
!
eb_width_possible
(
widths
))
goto
kill
;
return
;
}
...
...
This diff is collapsed.
Click to expand it.
api/transport/posix-ip.c
+
9
−
3
View file @
fe018e9e
...
...
@@ -123,12 +123,18 @@ socklen_t eb_posix_ip_resolve(const char* prefix, const char* address, int type,
return
len
;
}
void
eb_posix_ip_non_blocking
(
eb_posix_sock_t
sock
,
unsigned
long
on
)
{
void
eb_posix_ip_
force_
non_blocking
(
eb_posix_sock_t
sock
,
unsigned
long
on
)
{
#if defined(__WIN32)
ioctlsocket
(
sock
,
FIONBIO
,
&
on
);
#elif defined(EB_POSIX_IP_NON_BLOCKING_NOOP)
/* no-op. DONTWAIT is faster */
#else
ioctl
(
sock
,
FIONBIO
,
&
on
);
#endif
}
void
eb_posix_ip_non_blocking
(
eb_posix_sock_t
sock
,
unsigned
long
on
)
{
#if defined(EB_POSIX_IP_NON_BLOCKING_NOOP)
/* no-op. DONTWAIT is faster */
#else
eb_posix_ip_force_non_blocking
(
sock
,
on
);
#endif
}
This diff is collapsed.
Click to expand it.
api/transport/posix-ip.h
+
2
−
3
View file @
fe018e9e
...
...
@@ -51,17 +51,16 @@ typedef SOCKET eb_posix_sock_t;
typedef
eb_descriptor_t
eb_posix_sock_t
;
#if defined(MSG_DONTWAIT)
&& defined(SOCK_NONBLOCK)
#if defined(MSG_DONTWAIT)
#define EB_POSIX_IP_NON_BLOCKING_NOOP
#else
#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
#endif
#endif
EB_PRIVATE
void
eb_posix_ip_close
(
eb_posix_sock_t
sock
);
EB_PRIVATE
eb_posix_sock_t
eb_posix_ip_open
(
int
type
,
const
char
*
port
);
EB_PRIVATE
socklen_t
eb_posix_ip_resolve
(
const
char
*
prefix
,
const
char
*
address
,
int
type
,
struct
sockaddr_storage
*
out
);
EB_PRIVATE
void
eb_posix_ip_non_blocking
(
eb_posix_sock_t
sock
,
unsigned
long
on
);
EB_PRIVATE
void
eb_posix_ip_force_non_blocking
(
eb_posix_sock_t
sock
,
unsigned
long
on
);
#endif
This diff is collapsed.
Click to expand it.
api/transport/posix-tcp.c
+
1
−
6
View file @
fe018e9e
...
...
@@ -46,7 +46,7 @@ eb_status_t eb_posix_tcp_open(struct eb_transport* transportp, const char* port)
return
EB_ADDRESS
;
}
eb_posix_ip_non_blocking
(
sock
,
1
);
eb_posix_ip_
force_
non_blocking
(
sock
,
1
);
transport
=
(
struct
eb_posix_tcp_transport
*
)
transportp
;
transport
->
port
=
sock
;
...
...
@@ -160,12 +160,7 @@ int eb_posix_tcp_accept(struct eb_transport* transportp, struct eb_link* result_
transport
=
(
struct
eb_posix_tcp_transport
*
)
transportp
;
#ifdef EB_POSIX_IP_NON_BLOCKING_NOOP
sock
=
accept4
(
transport
->
port
,
0
,
0
,
SOCK_NONBLOCK
);
#else
sock
=
accept
(
transport
->
port
,
0
,
0
);
#endif
if
(
sock
==
-
1
)
{
if
(
errno
!=
EAGAIN
)
return
-
1
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment