summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* - Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constantsdoko@ubuntu.com2016-06-131-0/+2
| | | | | exposed on the API which are not implemented on GNU/Hurd. They would not work at runtime anyway.
* Issue #26857: The gethostbyaddr_r() workaround is no longer needed withStefan Krah2016-05-221-1/+5
| | | | api-level >= 23. Patch by Xavier de Gaye.
* Issue #26857: Workaround for missing symbol "gethostbyaddr_r" on Android.Stefan Krah2016-04-261-1/+1
|
* Issue #26057: Got rid of nonneeded use of PyUnicode_FromObject().Serhiy Storchaka2016-04-131-24/+20
|
* Issue #26685: Raise OSError if closing a socket failsMartin Panter2016-04-111-1/+5
|
* socketmodule.c: error if option larger than INT_MAXVictor Stinner2016-03-231-3/+16
| | | | | On Windows, socket.setsockopt() raises an OverflowError if the socket option is larger than INT_MAX bytes.
* Add socket finalizerVictor Stinner2016-03-211-18/+53
| | | | | | | Issue #26590: Implement a safe finalizer for the _socket.socket type. It now releases the GIL to close the socket. Use PyErr_ResourceWarning() to raise the ResourceWarning to pass the socket object to the warning logger, to get the traceback where the socket was created (allocated).
* ResourceWarning: Revert change on socket and scandirVictor Stinner2016-03-191-1/+2
| | | | io.FileIO has a safe implementation of destructor, but not socket nor scandir.
* On ResourceWarning, log traceback where the object was allocatedVictor Stinner2016-03-191-2/+1
| | | | | | | | | | Issue #26567: * Add a new function PyErr_ResourceWarning() function to pass the destroyed object * Add a source attribute to warnings.WarningMessage * Add warnings._showwarnmsg() which uses tracemalloc to get the traceback where source object was allocated.
* Issue #26406: merge from 3.5Ned Deily2016-02-231-4/+10
|\
| * Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls onNed Deily2016-02-231-4/+10
| | | | | | | | current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis.
* | Issue #25924: merge with 3.5Ned Deily2016-02-151-2/+18
|\ \ | |/
| * Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on OS XNed Deily2016-02-151-2/+18
| | | | | | | | versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis.
* | Merge 3.5: Issue #26227Victor Stinner2016-01-281-2/+24
|\ \ | |/
| * Windows: Decode hostname from ANSI code pageVictor Stinner2016-01-281-2/+24
| | | | | | | | | | | | Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions of the socket module now decode the hostname from the ANSI code page rather than UTF-8.
| * Close #24784: Fix compilation without thread supportVictor Stinner2015-10-111-0/+2
| | | | | | | | | | | | | | | | Add "#ifdef WITH_THREAD" around cals to: * PyGILState_Check() * _PyImport_AcquireLock() * _PyImport_ReleaseLock()
* | Fix compiler warning about obviously unreachable code.Raymond Hettinger2016-01-251-4/+0
| |
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-2/+2
| | | | | | | | private functions.
* | Close #24784: Fix compilation without thread supportVictor Stinner2015-10-111-0/+2
|/ | | | | | | | Add "#ifdef WITH_THREAD" around cals to: * PyGILState_Check() * _PyImport_AcquireLock() * _PyImport_ReleaseLock()
* Merge 3.4Victor Stinner2015-09-111-3/+1
|\
| * Issue #24684: socket.socket.getaddrinfo() now callsVictor Stinner2015-09-111-3/+1
| | | | | | | | | | | | | | PyUnicode_AsEncodedString() instead of calling the encode() method of the host, to handle correctly custom string with an encode() method which doesn't return a byte string. The encoder of the IDNA codec is now called directly instead of calling the encode() method of the string.
| * Issue #23834: Fix socket.sendto(), use the C Py_ssize_t type to store theVictor Stinner2015-04-021-1/+2
| | | | | | | | result of sendto() instead of the C int type.
* | Issue #24732, #23834: Fix sock_accept_impl() on WindowsVictor Stinner2015-07-271-0/+5
| | | | | | | | accept() returns INVALID_SOCKET on error, it's not necessary a negative number.
* | Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES.Larry Hastings2015-04-131-0/+3
| | | | | | | | Patch courtesy of Joe Jevnik.
* | Issue #23618: Fix internal_select() for negative timeout (blocking socket) whenVictor Stinner2015-04-091-4/+9
| | | | | | | | | | | | | | poll() is not available. select() doesn't accept negative timeout, the timeout parameter must be NULL to block on select().
* | Issue #23834: Fix the default socket timeoutVictor Stinner2015-04-091-1/+2
| | | | | | | | Use -1 second by default, not -1 nanosecond.
* | Issue #22117: Fix sock_call_ex() for non-blocking socketVictor Stinner2015-04-061-1/+1
| | | | | | | | | | Call internal_select() with a timeout of 0 second, not a timeout of -1 second (blocking)!
* | Issue #23853: socket.socket.sendall() does no more reset the socket timeoutVictor Stinner2015-04-061-16/+41
| | | | | | | | | | each time data is sent successfuly. The socket timeout is now the maximum total duration to send all data.
* | Issue #23834: Fix initial value of the socket timeoutVictor Stinner2015-04-061-2/+2
| | | | | | | | | | | | Use _PyTime_FromSeconds() to initialize the default socket timeout to -1 second, instead of -1 nanosecond which causes rounding issues in internal_select().
* | Issue #23834: Simplify timeout handlingVictor Stinner2015-04-031-27/+13
| | | | | | | | | | | | | | | | | | | | | | * Use the new _PyTime_FromSeconds() function to set the timeout to -1 second for socket.settimeout(None). It avoids a special case in internal_select() because of a rounding issue: -1 nanosecond is rounded to 0 millisecond which means non-blocking, instead of blocking. * Check if the interval the negative in sock_call_ex() instead of doing the check in internal_select(). sock_call_ex() remembers if the socket has a timeout or not, which avoids a race condition if the timeout is modified in a different thread.
* | Issue #23618: Ooops, remove abort() added for debug purposeVictor Stinner2015-04-021-1/+0
| |
* | Issue #23618: Fix sock_connect_impl(), set the socket error codeVictor Stinner2015-04-021-1/+7
| | | | | | | | | | sock_call_ex() gets the socket error code when the socket function fails. sock_connect_impl() didn't set the error correctly.
* | Issue #23618: socket.socket.connect() now waits until the connection completesVictor Stinner2015-04-021-124/+178
| | | | | | | | | | | | | | | | instead of raising InterruptedError if the connection is interrupted by signals, signal handlers don't raise an exception and the socket is blocking or has a timeout. socket.socket.connect() still raise InterruptedError for non-blocking sockets.
* | Issue #23618: Don't declare recvmsg/sendmsg helper functions on WindowsVictor Stinner2015-04-021-7/+6
| |
* | Issue #23834: Fix sock_call(), set deadline_initialized to recompute the timeoutVictor Stinner2015-04-021-0/+1
| |
* | Issue #23834: Modify socket.sendall() to reuse sock_call() withVictor Stinner2015-04-011-29/+21
| | | | | | | | sock_send_impl()
* | Issue #23834: Add sock_call() helper functionVictor Stinner2015-04-011-256/+323
| | | | | | | | | | | | | | | | | | | | The BEGIN_SELECT_LOOP and END_SELECT_LOOP macros of socketmodule.c don't handle EINTR. Functions using these macros use an inner loop to handle EINTR, but they don't recompute the timeout. This changes replaces the two macros with a new sock_call() function which takes a function as a parameter. sock_call() recomputes the timeout, handle false positive and handle EINTR.
* | merge 3.4Benjamin Peterson2015-04-011-1/+2
|\ \ | |/
| * remove assignment in conditionalBenjamin Peterson2015-04-011-1/+2
| |
* | Issue #23618: Fix EINTR handling on WindowsVictor Stinner2015-04-011-2/+2
| | | | | | | | Windows uses WSAEINTR error code, not EINTR, for socket functions.
* | Issue #23618: Enhance EINTR handling in socket.connect()Victor Stinner2015-03-311-35/+37
| | | | | | | | | | | | | | Call PyErr_CheckSignals() immediatly if connect() or select() fails with EINTR in internal_connect(). Refactor also the code to limit indentaton and make it more readable.
* | Issue #23618: Fix EINTR handling in socket.connect()Victor Stinner2015-03-311-10/+8
| | | | | | | | | | Call PyErr_CheckSignals() if connect(), select() or getsockopt() failed with EINTR.
* | Issue #23618: Cleanup internal_connect() in socketmodule.cVictor Stinner2015-03-311-3/+1
| | | | | | | | | | On Windows, it looks like using the C type socklen_t for getsockopt() (instead of int) is fine, it was already used in socket.getsockopt().
* | Issue #23618: Refactor internal_connect()Victor Stinner2015-03-311-79/+30
| | | | | | | | | | On Windows, internal_connect() now reuses internal_connect_select() and always calls getsockopt().
* | Issue #23618: Refactor internal_connect()Victor Stinner2015-03-311-35/+57
| | | | | | | | | | | | | | The function now returns the error code instead of using the global errno (POSIX) or WSAGetLastError() (Windows). internal_connect() now returns errno if getsockopt() fails.
* | Issue #22117: Fix integer overflow check in socket_parse_timeout() on WindowsVictor Stinner2015-03-311-3/+6
| |
* | Issue #23618: Fix internal_connect_select()Victor Stinner2015-03-311-1/+1
| |
* | Issue #23618: internal_connect_select() now waits also for error eventsVictor Stinner2015-03-311-6/+15
| |
* | Issue #23618: Refactor internal_select() to prepare socket.connect() for EINTRVictor Stinner2015-03-311-13/+23
| |
* | Issue #23618: Refactor the _socket moduleVictor Stinner2015-03-311-17/+11
| | | | | | | | | | * Inline internal_select() function * Rename internal_select_ex() internal_select()