Преглед на файлове

*** empty log message ***

eihrul преди 18 години
родител
ревизия
6a6e61b4bd
променени са 3 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 3 1
      include/enet/enet.h
  2. 1 0
      unix.c
  3. 1 0
      win32.c

+ 3 - 1
include/enet/enet.h

@@ -44,7 +44,9 @@ typedef enum
 enum
 {
    ENET_HOST_ANY       = 0,            /**< specifies the default server host */
-   ENET_HOST_BROADCAST = 0xFFFFFFFF    /**< specifies a subnet-wide broadcast */
+   ENET_HOST_BROADCAST = 0xFFFFFFFF,   /**< specifies a subnet-wide broadcast */
+
+   ENET_PORT_ANY       = 0             /**< specifies that a port should be automatically chosen */
 };
 
 /**

+ 1 - 0
unix.c

@@ -193,6 +193,7 @@ enet_socket_create (ENetSocketType type, const ENetAddress * address)
               (struct sockaddr *) & sin,
               sizeof (struct sockaddr_in)) == -1 ||
         (type == ENET_SOCKET_TYPE_STREAM &&
+          address -> port != ENET_PORT_ANY &&
           listen (newSocket, SOMAXCONN) == -1))
     {
        close (newSocket);

+ 1 - 0
win32.c

@@ -142,6 +142,7 @@ enet_socket_create (ENetSocketType type, const ENetAddress * address)
               sizeof (struct sockaddr_in)) == SOCKET_ERROR ||
         (type == ENET_SOCKET_TYPE_STREAM &&
           address != NULL &&
+          address -> port != ENET_PORT_ANY &&
           listen (newSocket, SOMAXCONN) == SOCKET_ERROR))
     {
        closesocket (newSocket);