summaryrefslogtreecommitdiffstats
path: root/adb/sysdeps_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'adb/sysdeps_win32.c')
-rw-r--r--adb/sysdeps_win32.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/adb/sysdeps_win32.c b/adb/sysdeps_win32.c
index e69ec2b..f132b8c 100644
--- a/adb/sysdeps_win32.c
+++ b/adb/sysdeps_win32.c
@@ -440,7 +440,8 @@ int adb_shutdown(int fd)
{
FH f = _fh_from_int(fd);
- if (!f) {
+ if (!f || f->clazz != &_fh_socket_class) {
+ D("adb_shutdown: invalid fd %d\n", fd);
return -1;
}
@@ -471,6 +472,8 @@ int adb_close(int fd)
/**************************************************************************/
/**************************************************************************/
+#undef setsockopt
+
static void
_socket_set_errno( void )
{
@@ -786,15 +789,16 @@ int adb_socket_accept(int serverfd, struct sockaddr* addr, socklen_t *addrle
}
-void disable_tcp_nagle(int fd)
+int adb_setsockopt( int fd, int level, int optname, const void* optval, socklen_t optlen )
{
FH fh = _fh_from_int(fd);
- int on = 1;
- if ( !fh || fh->clazz != &_fh_socket_class )
- return;
+ if ( !fh || fh->clazz != &_fh_socket_class ) {
+ D("adb_setsockopt: invalid fd %d\n", fd);
+ return -1;
+ }
- setsockopt( fh->fh_socket, IPPROTO_TCP, TCP_NODELAY, (const char*)&on, sizeof(on) );
+ return setsockopt( fh->fh_socket, level, optname, optval, optlen );
}
/**************************************************************************/