fix unpack in from_sockaddr

git-svn-id: file:///home/svn/incoming/trunk@3672 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2006-06-16 03:11:53 +00:00
parent 4f21fc4709
commit 3e37b5993f
1 changed files with 2 additions and 2 deletions

View File

@ -142,13 +142,13 @@ module Socket
# [ af, host, port ]
#
def self.from_sockaddr(saddr)
up = saddr.unpack('snA*')
up = saddr.unpack('snA*')
af = up.shift
port = up.shift
case af
when ::Socket::AF_INET
return [ af, up.shift.unpack('C*').join('.'), port ]
return [ af, up.shift[0, 4].unpack('C*').join('.'), port ]
when ::Socket::AF_INET6
return [ af, up.shift.unpack('H*').gsub(/(....)/){ |r| r << ':' }.sub(/:$/, ''), port ]