[enet-cvs] CVS: enet/pyenet enet.pyx,1.4,1.5
Lee Salzman
enet at sferik.cubik.org
Mon Mar 29 15:24:15 PST 2004
Update of /home/enet/cvsroot/enet/pyenet
In directory sferik:/tmp/cvs-serv2765
Modified Files:
enet.pyx
Log Message:
pyenet patches
Index: enet.pyx
===================================================================
RCS file: /home/enet/cvsroot/enet/pyenet/enet.pyx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- enet.pyx 2004/02/10 02:53:30 1.4
+++ enet.pyx 2004/03/29 23:24:13 1.5
@@ -56,6 +56,9 @@
# Removed a few, and added a couple of obvious todos for the future.
# Fixed Address.__getattr__ extra \0s in the case .host.
#
+# Fri Feb 13 18:18:04 PST 2004 Scott Robinson <scott at tranzoa.com>
+# Added Socket class for use with select and poll.
+#
import atexit
@@ -77,6 +80,9 @@
cdef enum :
ENET_HOST_ANY = 0
+ # TODO: Handle Windows situation.
+ ctypedef int ENetSocket
+
ctypedef struct ENetAddress :
enet_uint32 host
enet_uint16 port
@@ -112,6 +118,7 @@
enet_uint32 roundTripTime
ctypedef struct ENetHost :
+ ENetSocket socket
ENetAddress address
ctypedef enum ENetEventType :
@@ -177,6 +184,20 @@
# SECTION
# Python exposed class definitions.
+cdef class Socket :
+ """Socket (int socket)
+
+ DESCRIPTION
+
+ An ENet socket.
+
+ Can be used with select and poll."""
+
+ cdef ENetSocket _enet_socket
+
+ def fileno (self) :
+ return self._enet_socket
+
cdef class Address :
"""Address (str address, int port)
@@ -284,7 +305,7 @@
.PEER_STATE_CONNECTING
.PEER_STATE_CONNECTED
.PEER_STATE_DISCONNECTING
- .PEER_STATE_ACKNOWLEDGING_DISCONNECTION
+ .PEER_STATE_ACKNOWLEDGING_DISCONNECT
.PEER_STATE_ZOMBIE
int packetLoss Mean packet loss of reliable packets as a ratio with respect to the constant enet.PEER_PACKET_LOSS_SCALE.
int packetThrottleAcceleration
@@ -435,6 +456,7 @@
ATTRIBUTES
Address address Internet address of the host.
+ Socket socket The socket the host services.
int incomingBandwidth Downstream bandwidth of the host.
int outgoingBandwidth Upstream bandwidth of the host.
@@ -518,6 +540,11 @@
return self._enet_incomingBandwidth
elif name == "outgoingBandwidth" :
return self._enet_outgoingBandwidth
+ elif name == "socket" :
+ socket = Socket ()
+ (<Socket> socket)._enet_socket = self._enet_host.socket
+
+ return socket
else :
raise AttributeError ("Host object has no attribute '" + name + "'")
@@ -533,6 +560,9 @@
# SECTION
# Testing
+#
+# TODO
+# Switch to using the unittest framework.
class test :
"""test ()
More information about the enet-cvs
mailing list