Commit 673120d8 authored by Alex Gaynor's avatar Alex Gaynor
Browse files

merged upstream

......@@ -22,6 +22,8 @@ from rpython.rlib.rthread import dummy_lock
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper.lltypesystem.rffi import sizeof, offsetof
INVALID_SOCKET = _c.INVALID_SOCKET
from rpython.rlib import jit
def mallocbuf(buffersize):
return lltype.malloc(rffi.CCHARP.TO, buffersize, flavor='raw')
......@@ -592,6 +594,7 @@ class RSocket(object):
addrlen_p[0] = rffi.cast(_c.socklen_t, maxlen)
return addr, addr.addr_p, addrlen_p
@jit.dont_look_inside
def accept(self):
"""Wait for an incoming connection.
Return (new socket fd, client address)."""
......@@ -724,6 +727,7 @@ class RSocket(object):
return make_socket(fd, self.family, self.type, self.proto,
SocketClass=SocketClass)
@jit.dont_look_inside
def getpeername(self):
"""Return the address of the remote endpoint."""
address, addr_p, addrlen_p = self._addrbuf()
......@@ -738,6 +742,7 @@ class RSocket(object):
address.addrlen = rffi.cast(lltype.Signed, addrlen)
return address
@jit.dont_look_inside
def getsockname(self):
"""Return the address of the local endpoint."""
address, addr_p, addrlen_p = self._addrbuf()
......@@ -752,6 +757,7 @@ class RSocket(object):
address.addrlen = rffi.cast(lltype.Signed, addrlen)
return address
@jit.dont_look_inside
def getsockopt(self, level, option, maxlen):
buf = mallocbuf(maxlen)
try:
......@@ -771,6 +777,7 @@ class RSocket(object):
lltype.free(buf, flavor='raw')
return result
@jit.dont_look_inside
def getsockopt_int(self, level, option):
flag_p = lltype.malloc(rffi.INTP.TO, 1, flavor='raw')
try:
......@@ -828,6 +835,7 @@ class RSocket(object):
rwbuffer.setslice(0, buf)
return len(buf)
@jit.dont_look_inside
def recvfrom(self, buffersize, flags=0):
"""Like recv(buffersize, flags) but also return the sender's
address."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment