Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f90a113

Browse files
committed
Fixed listen()/getsockname() bug
1 parent a42960c commit f90a113

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

Mac/Unsupported/mactcp/socket.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ def connect(self, host, port):
125125
self.stream.ActiveOpen(self.port, _ipaddress(host), port)
126126

127127
def getsockname(self):
128-
st = self.stream.Status()
129-
host = macdnr.AddrToStr(st.localHost)
130-
return host, st.localPort
128+
host, port = self.stream.GetSockName()
129+
host = macdnr.AddrToStr(host)
130+
return host, port
131131

132132
def getpeername(self):
133133
st = self.stream.Status()
@@ -147,9 +147,6 @@ def recv(self, bufsize, flags=0):
147147
if not self.databuf:
148148
try:
149149
self.databuf, urg, mark = self.stream.Rcv(0)
150-
if not self.databuf:
151-
print '** socket: no data!'
152-
print '** recv: got ', len(self.databuf)
153150
except mactcp.error, arg:
154151
if arg[0] != MACTCP.connectionClosing:
155152
raise mactcp.error, arg
@@ -211,7 +208,6 @@ def readline(self):
211208
i = string.index(self.buf, '\n')
212209
rv = self.buf[:i+1]
213210
self.buf = self.buf[i+1:]
214-
print '** Readline:',self, `rv`
215211
return rv
216212

217213
def write(self, buf):

0 commit comments

Comments
 (0)