mirror of https://github.com/python/cpython.git
Fixed listen()/getsockname() bug
This commit is contained in:
parent
a42960cd09
commit
f90a113176
|
@ -125,9 +125,9 @@ def connect(self, host, port):
|
||||||
self.stream.ActiveOpen(self.port, _ipaddress(host), port)
|
self.stream.ActiveOpen(self.port, _ipaddress(host), port)
|
||||||
|
|
||||||
def getsockname(self):
|
def getsockname(self):
|
||||||
st = self.stream.Status()
|
host, port = self.stream.GetSockName()
|
||||||
host = macdnr.AddrToStr(st.localHost)
|
host = macdnr.AddrToStr(host)
|
||||||
return host, st.localPort
|
return host, port
|
||||||
|
|
||||||
def getpeername(self):
|
def getpeername(self):
|
||||||
st = self.stream.Status()
|
st = self.stream.Status()
|
||||||
|
@ -147,9 +147,6 @@ def recv(self, bufsize, flags=0):
|
||||||
if not self.databuf:
|
if not self.databuf:
|
||||||
try:
|
try:
|
||||||
self.databuf, urg, mark = self.stream.Rcv(0)
|
self.databuf, urg, mark = self.stream.Rcv(0)
|
||||||
if not self.databuf:
|
|
||||||
print '** socket: no data!'
|
|
||||||
print '** recv: got ', len(self.databuf)
|
|
||||||
except mactcp.error, arg:
|
except mactcp.error, arg:
|
||||||
if arg[0] != MACTCP.connectionClosing:
|
if arg[0] != MACTCP.connectionClosing:
|
||||||
raise mactcp.error, arg
|
raise mactcp.error, arg
|
||||||
|
@ -211,7 +208,6 @@ def readline(self):
|
||||||
i = string.index(self.buf, '\n')
|
i = string.index(self.buf, '\n')
|
||||||
rv = self.buf[:i+1]
|
rv = self.buf[:i+1]
|
||||||
self.buf = self.buf[i+1:]
|
self.buf = self.buf[i+1:]
|
||||||
print '** Readline:',self, `rv`
|
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def write(self, buf):
|
def write(self, buf):
|
||||||
|
|
Loading…
Reference in New Issue