axeld + bonefish:
* Added syscall restart support for connect(), accept(), send(), recv(), which are implemented via ioctl()s. The actual restart support is done in the net stack driver's ioctl() hook. Lower layers need to correctly deal with socket timeouts, though, for which the stack module provides support functions. * TCPEndpoint::_WaitForEstablished() does abort now when an error occurred earlier, so that trying to connect to an unused port fails immediately, as it should. * Fixed and refactored TCP connection reset handling. The new TCPEndpoint::_HandleReset() does the job. Got rid of TCPEndpoint::fError. * Fixed sequence numbers for SYNC/FINI packets. * The former two fix the problem that connections wouldn't be closed correctly and could even be reused when trying to connect again (as was reproducible with svnserve + svn). * Some style cleanup in CPEndpoint.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -348,6 +348,11 @@ DECL_DATAGRAM_SOCKET(inline bigtime_t)::_SocketTimeout(uint32 flags) const
|
||||
else if (timeout != 0 && timeout != B_INFINITE_TIMEOUT)
|
||||
timeout += system_time();
|
||||
|
||||
if (ModuleBundle::Stack()->is_restarted_syscall())
|
||||
timeout = ModuleBundle::Stack()->restore_syscall_restart_timeout();
|
||||
else
|
||||
ModuleBundle::Stack()->store_syscall_restart_timeout(timeout);
|
||||
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef NET_STACK_H
|
||||
@@ -44,8 +44,9 @@ struct net_timer {
|
||||
bigtime_t due;
|
||||
};
|
||||
|
||||
typedef int32 (*net_deframe_func)(struct net_device *device, struct net_buffer *buffer);
|
||||
typedef status_t (*net_receive_func)(void *cookie, struct net_device *,
|
||||
typedef int32 (*net_deframe_func)(struct net_device *device,
|
||||
struct net_buffer *buffer);
|
||||
typedef status_t (*net_receive_func)(void *cookie, struct net_device *device,
|
||||
struct net_buffer *buffer);
|
||||
|
||||
enum {
|
||||
@@ -132,6 +133,11 @@ struct net_stack_module_info {
|
||||
void (*set_timer)(struct net_timer *timer, bigtime_t delay);
|
||||
bool (*cancel_timer)(struct net_timer *timer);
|
||||
bool (*is_timer_active)(struct net_timer *timer);
|
||||
|
||||
// syscall restart
|
||||
bool (*is_restarted_syscall)(void);
|
||||
void (*store_syscall_restart_timeout)(bigtime_t timeout);
|
||||
bigtime_t (*restore_syscall_restart_timeout)(void);
|
||||
};
|
||||
|
||||
#endif // NET_STACK_H
|
||||
|
||||
Reference in New Issue
Block a user