[WSD] Change ib_listen to return an error value rather than set it
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 Sep 2005 00:22:59 +0000 (00:22 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 Sep 2005 00:22:59 +0000 (00:22 +0000)
as output parameter.

Signed-off-by: Fab Tillier (ftillier@silverstorm.com)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@87 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/wsd/user/ib_cm.c
ulp/wsd/user/ibspdll.c
ulp/wsd/user/ibspproto.h

index 82d8057..c82fb0f 100644 (file)
@@ -505,7 +505,6 @@ cm_dreq_callback(
                case DISC_DUPLICATING:\r
                        {\r
                                int ret;\r
-                               int error;\r
 \r
                                IBSP_CHANGE_SOCKET_STATE( socket_info, IBSP_DUPLICATING_REMOTE );\r
                                socket_info->qp_error = -1;\r
@@ -518,11 +517,11 @@ cm_dreq_callback(
                                socket_info->listen.listen_req_param.identifier =\r
                                        reason->duplicating.identifier;\r
 \r
-                               ret = ib_listen( socket_info, &error );\r
+                               ret = ib_listen( socket_info );\r
                                if( !ret )\r
                                        break;\r
 \r
-                               IBSP_ERROR_EXIT( ("ib_listen failed with %d\n", error) );\r
+                               IBSP_ERROR_EXIT( ("ib_listen failed with %d\n", ret) );\r
                                /* Fall through. */\r
                        }\r
                default:\r
@@ -627,8 +626,7 @@ cm_lap_callback(
 /* Listen for an incoming connection. */\r
 int\r
 ib_listen(\r
-       IN                              struct ibsp_socket_info         *socket_info,\r
-               OUT                     LPINT                                           lpErrno )\r
+       IN                              struct ibsp_socket_info         *socket_info )\r
 {\r
        ib_cm_listen_t param;\r
        ib_api_status_t status;\r
@@ -672,8 +670,7 @@ ib_listen(
        if( status != IB_SUCCESS )\r
        {\r
                IBSP_ERROR_EXIT( ("ib_cm_listen failed (0x%d)\n", status) );\r
-               *lpErrno = ibal_to_wsa_error( status );\r
-               return SOCKET_ERROR;\r
+               return ibal_to_wsa_error( status );\r
        }\r
 \r
        STAT_INC( listen_num );\r
@@ -682,7 +679,6 @@ ib_listen(
                ("started listening for port %d\n",\r
                CL_HTON16( socket_info->local_addr.sin_port )) );\r
 \r
-       *lpErrno = 0;\r
        return 0;\r
 }\r
 \r
@@ -963,8 +959,10 @@ ib_disconnect(
        status = ib_modify_qp( socket_info->qp, &qp_mod );\r
        if( status != IB_SUCCESS )\r
        {\r
+               IBSP_ERROR( ("ib_modify_qp returned %s\n", ib_get_err_str( status )) );\r
                socket_info->send_cnt = 0;\r
                socket_info->recv_cnt = 0;\r
        }\r
+\r
        IBSP_EXIT( IBSP_DBG_CM );\r
 }\r
index 57efd2f..cd28646 100644 (file)
@@ -721,7 +721,6 @@ IBSPCloseSocket(
 \r
        shutdown_and_destroy_socket_info( socket_info );\r
 \r
-\r
        IBSP_EXIT( IBSP_DBG_CONN );\r
 \r
        *lpErrno = 0;\r
@@ -1490,38 +1489,34 @@ IBSPListen(
                socket_info->listen.listen_req_param.dwProcessId = 0;\r
                socket_info->listen.listen_req_param.identifier = 0;\r
 \r
-               ret = ib_listen( socket_info, lpErrno );\r
+               ret = ib_listen( socket_info );\r
                if( ret )\r
                {\r
                        IBSP_CHANGE_SOCKET_STATE( socket_info, IBSP_BIND );\r
-                       IBSP_ERROR_EXIT( ("ib_listen failed with %d\n", ret) );\r
+                       CL_EXIT_ERROR( IBSP_DBG_CONN, gdbg_lvl, ("ib_listen failed with %d\n", ret) );\r
                }\r
-               else\r
-               {\r
-                       *lpErrno = 0;\r
-               }\r
-\r
                break;\r
 \r
        case IBSP_LISTEN:\r
                /* Change the backlog */\r
                ib_listen_backlog( socket_info, backlog );\r
-               *lpErrno = 0;\r
+               ret = 0;\r
                break;\r
 \r
        default:\r
                IBSP_ERROR(\r
                        ("Invalid socket_state (%s)\n",\r
                        IBSP_SOCKET_STATE_STR( socket_info->socket_state )) );\r
-               *lpErrno = WSAEINVAL;\r
+               ret = WSAEINVAL;\r
                break;\r
        }\r
 \r
        cl_spinlock_release( &socket_info->mutex );\r
 \r
-       IBSP_EXIT( IBSP_DBG_CONN );\r
+       *lpErrno = ret;\r
 \r
-       if( *lpErrno )\r
+       IBSP_EXIT( IBSP_DBG_CONN );\r
+       if( ret )\r
                return SOCKET_ERROR;\r
        else\r
                return 0;\r
index 9a5f867..1fc338e 100644 (file)
@@ -183,8 +183,7 @@ get_port_from_ip_address(
 /* Protos from ibsp_cm.c */\r
 extern int\r
 ib_listen(\r
-       IN                              struct ibsp_socket_info         *socket_info,\r
-               OUT                     LPINT                                           lpErrno );\r
+       IN                              struct ibsp_socket_info         *socket_info );\r
 \r
 void\r
 ib_listen_cancel(\r