diff --git a/examples/normSocket.cpp b/examples/normSocket.cpp index 3a237b9..5d57b8c 100644 --- a/examples/normSocket.cpp +++ b/examples/normSocket.cpp @@ -1180,6 +1180,7 @@ void NormSocket::GetSocketEvent(const NormEvent& event, NormSocketEvent& socketE socketEvent.type = NORM_SOCKET_CONNECT; NormSetSynStatus(norm_session, false); socket_state = CONNECTED; + // Since UDP connect/bind doesn't really work properly on // Windows, the Windows NormSocket server farms out client connections // to new ephemeral port numbers, so we need to update @@ -1187,12 +1188,11 @@ void NormSocket::GetSocketEvent(const NormEvent& event, NormSocketEvent& socketE remote_node = event.sender; UpdateRemoteAddress(); NormChangeDestination(norm_session, NULL, remote_port); - if (NORM_OBJECT_INVALID == tx_stream) + if ((NORM_OBJECT_INVALID == tx_stream) && !(IsMulticastClient() && IsServerSide())) { tx_stream = NormStreamOpen(norm_session, socket_option.buffer_size); InitTxStream(tx_stream, socket_option.buffer_size, socket_option.segment_size, socket_option.num_data); } - break; case CONNECTED: if (IsMulticastSocket()) @@ -1200,7 +1200,31 @@ void NormSocket::GetSocketEvent(const NormEvent& event, NormSocketEvent& socketE if (IsServerSocket()) { // New client showing up at our multicast party - socketEvent.type = NORM_SOCKET_ACCEPT; + NormSocketInfo* socketInfo = client_table.FindSocketInfo(event.sender); + if (NULL == socketInfo) + { + // Add info for client socket pending acceptance + socketInfo = new NormSocketInfo(NormGetSocketInfo(event.sender)); + if (NULL != socketInfo) + { + client_table.Insert(*socketInfo); + socketEvent.type = NORM_SOCKET_ACCEPT; + } + else + { + perror("NormSocket::GetSocketEvent() error: unable to add pending client info to server socket:\n"); + } + } + else // duplicative accept event for existing socket, so ignore + { + ProtoAddress remoteAddr; + socketInfo->GetRemoteAddress(remoteAddr); + fprintf(stderr, "NormSocket::GetSocketEvent() warning: duplicative %s from client %s/%hu...\n", + (NORM_REMOTE_SENDER_NEW == event.type) ? "new" : "reset", + remoteAddr.GetHostString(), remoteAddr.GetPort()); + // TBD - should we go ahead and delete this event.sender??? + } + } else { @@ -1429,7 +1453,6 @@ void NormSocket::GetSocketEvent(const NormEvent& event, NormSocketEvent& socketE else { // This still allows at least a chance of an ACK to be sent upon completion - TRACE("NormSetUserTimer(5) session: %p\n", norm_session); NormSetUserTimer(norm_session, 0.0); } socketEvent.type = NORM_SOCKET_CLOSING; diff --git a/include/normMessage.h b/include/normMessage.h index 7abe05a..1cc70b6 100644 --- a/include/normMessage.h +++ b/include/normMessage.h @@ -935,11 +935,11 @@ class NormFtiExtension5 : public NormHeaderExtension private: enum { - OBJ_SIZE_MSB_OFFSET = (CONTENT_OFFSET)/2, // UINT16 offset - OBJ_SIZE_LSB_OFFSET = ((OBJ_SIZE_MSB_OFFSET*2)+2)/4, - SEG_SIZE_OFFSET = ((OBJ_SIZE_LSB_OFFSET*4)+4)/2, - FEC_NDATA_OFFSET = ((SEG_SIZE_OFFSET+1)*2), - FEC_NPARITY_OFFSET = (FEC_NDATA_OFFSET+1) + OBJ_SIZE_MSB_OFFSET = (CONTENT_OFFSET)/2, // UINT16 offset + OBJ_SIZE_LSB_OFFSET = ((OBJ_SIZE_MSB_OFFSET*2)+2)/4,// UINT32 offset + SEG_SIZE_OFFSET = ((OBJ_SIZE_LSB_OFFSET*4)+4)/2, // UINT16 offset + FEC_NDATA_OFFSET = ((SEG_SIZE_OFFSET+1)*2), // UINT8 offset + FEC_NPARITY_OFFSET = (FEC_NDATA_OFFSET+1) // UINT8 offset }; }; // end class NormFtiExtension5 diff --git a/protolib b/protolib index 6609240..702e909 160000 --- a/protolib +++ b/protolib @@ -1 +1 @@ -Subproject commit 66092403ffeda703ad5e563be068db345f111a3c +Subproject commit 702e909945446275f0313846e988612883fca94a