[haiku-commits] haiku: hrev49217 - in src/add-ons/kernel/network: protocols/tcp stack

  • From: hamishm53@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 31 May 2015 18:36:52 +0200 (CEST)

hrev49217 adds 2 changesets to branch 'master'
old head: 03f60b036cbd42d9d10f5e17cd9e62b348791988
new head: 162ae6204b1c58e28bbeac66a2ee3de8ce745bc2
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=162ae6204b1c+%5E03f60b036cbd

----------------------------------------------------------------------------

2d5706f792a9: net_socket: notify of socket errors immediately when selected

162ae6204b1c: tcp: wait for connection to complete before notifying
B_SELECT_WRITE

[ Hamish Morrison <hamishm53@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 16 insertions(+), 6 deletions(-)
.../kernel/network/protocols/tcp/TCPEndpoint.cpp | 19 ++++++++++++++-----
src/add-ons/kernel/network/stack/net_socket.cpp | 3 ++-

############################################################################

Commit: 2d5706f792a9cc4f5d8bd19561ded3941f5099ab
URL: http://cgit.haiku-os.org/haiku/commit/?id=2d5706f792a9
Author: Hamish Morrison <hamishm53@xxxxxxxxx>
Date: Sat May 30 12:42:42 2015 UTC

net_socket: notify of socket errors immediately when selected

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/network/stack/net_socket.cpp
b/src/add-ons/kernel/network/stack/net_socket.cpp
index bc7b8de..5582351 100644
--- a/src/add-ons/kernel/network/stack/net_socket.cpp
+++ b/src/add-ons/kernel/network/stack/net_socket.cpp
@@ -905,7 +905,8 @@ socket_request_notification(net_socket* _socket, uint8
event, selectsync* sync)
break;
}
case B_SELECT_ERROR:
- // TODO: B_SELECT_ERROR condition!
+ if (socket->error != B_OK)
+ notify_select_event(sync, event);
break;
}


############################################################################

Revision: hrev49217
Commit: 162ae6204b1c58e28bbeac66a2ee3de8ce745bc2
URL: http://cgit.haiku-os.org/haiku/commit/?id=162ae6204b1c
Author: Hamish Morrison <hamishm53@xxxxxxxxx>
Date: Sat May 30 15:52:21 2015 UTC

tcp: wait for connection to complete before notifying B_SELECT_WRITE

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
index dc3a4a1..ce4769b 100644
--- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
+++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
@@ -320,8 +320,14 @@ segment_in_sequence(const tcp_segment_header& segment, int
size,
static inline bool
is_writable(tcp_state state)
{
- return state == SYNCHRONIZE_SENT || state == SYNCHRONIZE_RECEIVED
- || state == ESTABLISHED || state == FINISH_RECEIVED;
+ return state == ESTABLISHED || state == FINISH_RECEIVED;
+}
+
+
+static inline bool
+is_establishing(tcp_state state)
+{
+ return state == SYNCHRONIZE_SENT || state == SYNCHRONIZE_RECEIVED;
}


@@ -786,7 +792,7 @@ TCPEndpoint::SendData(net_buffer *buffer)
return ENOTCONN;
if (fState == LISTEN)
return EDESTADDRREQ;
- if (!is_writable(fState)) {
+ if (!is_writable(fState) && !is_establishing(fState)) {
// we only send signals when called from userland
if (gStackModule->is_syscall())
send_signal(find_thread(NULL), SIGPIPE);
@@ -812,7 +818,7 @@ TCPEndpoint::SendData(net_buffer *buffer)
return posix_error(status);
}

- if (!is_writable(fState)) {
+ if (!is_writable(fState) && !is_establishing(fState)) {
// we only send signals when called from
userland
if (gStackModule->is_syscall())
send_signal(find_thread(NULL), SIGPIPE);
@@ -873,6 +879,8 @@ TCPEndpoint::SendAvailable()

if (is_writable(fState))
available = fSendQueue.Free();
+ else if (is_establishing(fState))
+ available = 0;
else
available = EPIPE;

@@ -1182,6 +1190,7 @@ TCPEndpoint::_MarkEstablished()
}

fSendList.Signal();
+ gSocketModule->notify(socket, B_SELECT_WRITE, fSendQueue.Free());
}


@@ -2185,7 +2194,7 @@ TCPEndpoint::_Acknowledged(tcp_segment_header& segment)
if (is_writable(fState)) {
// notify threads waiting on the socket to become
writable again
fSendList.Signal();
- gSocketModule->notify(socket, B_SELECT_WRITE,
fSendQueue.Used());
+ gSocketModule->notify(socket, B_SELECT_WRITE,
fSendQueue.Free());
}

if (fCongestionWindow < fSlowStartThreshold)


Other related posts:

  • » [haiku-commits] haiku: hrev49217 - in src/add-ons/kernel/network: protocols/tcp stack - hamishm53