@@ -54,6 +54,7 @@ SteamNetworkingMessage_t* Steam_Networking_Sockets::get_steam_message_connection
5454 pMsg->m_pfnFreeData = &free_steam_message_data;
5555 pMsg->m_pfnRelease = &delete_steam_message;
5656 pMsg->m_nChannel = 0 ;
57+ pMsg->m_idxLane = static_cast <uint16>(connect_socket->second .data .top ().lane ());
5758 connect_socket->second .data .pop ();
5859 PRINT_DEBUG (" get_steam_message_connection %u %lu, %llu" , hConn, size, pMsg->m_nMessageNumber );
5960 return pMsg;
@@ -758,6 +759,7 @@ EResult Steam_Networking_Sockets::SendMessageToConnection( HSteamNetConnection h
758759 msg.mutable_networking_sockets ()->set_connection_id_from (connect_socket->first );
759760 msg.mutable_networking_sockets ()->set_connection_id (connect_socket->second .remote_id );
760761 msg.mutable_networking_sockets ()->set_data (pData, cbData);
762+ msg.mutable_networking_sockets ()->set_lane (0 );
761763 uint64 message_number = connect_socket->second .packet_send_counter ;
762764 msg.mutable_networking_sockets ()->set_message_number (message_number);
763765 connect_socket->second .packet_send_counter += 1 ;
@@ -816,7 +818,44 @@ void Steam_Networking_Sockets::SendMessages( int nMessages, SteamNetworkingMessa
816818 std::lock_guard<std::recursive_mutex> lock (global_mutex);
817819 for (int i = 0 ; i < nMessages; ++i) {
818820 int64 out_number = 0 ;
819- int result = SendMessageToConnection (pMessages[i]->m_conn , pMessages[i]->m_pData , pMessages[i]->m_cbSize , pMessages[i]->m_nFlags , &out_number);
821+ int result = k_EResultInvalidParam;
822+
823+ if (pMessages[i]) {
824+ auto connect_socket = sbcs->connect_sockets .find (pMessages[i]->m_conn );
825+ if (connect_socket == sbcs->connect_sockets .end ()) {
826+ result = k_EResultInvalidParam;
827+ } else if (connect_socket->second .status == CONNECT_SOCKET_CLOSED || connect_socket->second .status == CONNECT_SOCKET_TIMEDOUT ) {
828+ result = k_EResultNoConnection;
829+ } else if (connect_socket->second .status != CONNECT_SOCKET_CONNECTED && connect_socket->second .status != CONNECT_SOCKET_CONNECTING ) {
830+ result = k_EResultInvalidState;
831+ } else {
832+ Common_Message msg;
833+ msg.set_source_id (connect_socket->second .created_by .ConvertToUint64 ());
834+ msg.set_dest_id (connect_socket->second .remote_identity .GetSteamID64 ());
835+ msg.set_allocated_networking_sockets (new Networking_Sockets);
836+ msg.mutable_networking_sockets ()->set_type (Networking_Sockets::DATA );
837+ msg.mutable_networking_sockets ()->set_virtual_port (connect_socket->second .virtual_port );
838+ msg.mutable_networking_sockets ()->set_real_port (connect_socket->second .real_port );
839+ msg.mutable_networking_sockets ()->set_connection_id_from (connect_socket->first );
840+ msg.mutable_networking_sockets ()->set_connection_id (connect_socket->second .remote_id );
841+ msg.mutable_networking_sockets ()->set_data (pMessages[i]->m_pData , pMessages[i]->m_cbSize );
842+ msg.mutable_networking_sockets ()->set_lane (pMessages[i]->m_idxLane );
843+
844+ uint64 message_number = connect_socket->second .packet_send_counter ;
845+ msg.mutable_networking_sockets ()->set_message_number (message_number);
846+ connect_socket->second .packet_send_counter += 1 ;
847+
848+ bool reliable = false ;
849+ if (pMessages[i]->m_nFlags & k_nSteamNetworkingSend_Reliable) reliable = true ;
850+ if (network->sendTo (&msg, reliable)) {
851+ out_number = message_number;
852+ result = k_EResultOK;
853+ } else {
854+ result = k_EResultFail;
855+ }
856+ }
857+ }
858+
820859 if (pOutMessageNumberOrResult) {
821860 if (result == k_EResultOK) {
822861 pOutMessageNumberOrResult[i] = out_number;
0 commit comments