MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / recvMatrix

Method recvMatrix

SRC/actor/channel/TCP_SocketSSL.cpp:702–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700
701
702int
703TCP_SocketSSL::recvMatrix(int dbTag, int commitTag,
704 Matrix &theMatrix, ChannelAddress *theAddress)
705{
706 // first check address is the only address a TCP_socket can send to
707 SocketAddress *theSocketAddress = 0;
708 if (theAddress != 0) {
709 if (theAddress->getType() == SOCKET_TYPE)
710 theSocketAddress = (SocketAddress *)theAddress;
711 else {
712 opserr << "TCP_SocketSSL::recvMatrix() - a TCP_SocketSSL ";
713 opserr << "can only communicate with a TCP_SocketSSL";
714 opserr << " address given is not of type SocketAddress\n";
715 return -1;
716 }
717 if (memcmp((char *) &other_Addr.addr_in, (char *) &theSocketAddress->address.addr_in,
718 theSocketAddress->addrLength) != 0) {
719
720 opserr << "TCP_SocketSSL::recvMatrix() - a TCP_SocketSSL ";
721 opserr << "can only communicate with one other TCP_SocketSSL\n";
722 return -1;
723 }
724 }
725
726 // if o.k. get a pointer to the data in the Matrix and
727 // place the incoming data there
728 int nleft, nread;
729 double *data = theMatrix.data;
730 char *gMsg = (char *)data;;
731 nleft = theMatrix.dataSize * sizeof(double);
732
733 while (nleft > 0) {
734 nread = SSL_read(ssl, gMsg, nleft);
735 if (nread < 0) {
736 opserr << "TCP_SocketSSL::recvMatrix() - could not read data\n";
737 SSL_shutdown(ssl);
738 SSL_free(ssl);
739 SSL_CTX_free(ctx);
740 cleanup_sockets();
741 return -2;
742 }
743 nleft -= nread;
744 gMsg += nread;
745 }
746
747#ifndef _WIN32
748 if (endiannessProblem) {
749 void *array = (void *)data;
750 byte_swap(array, theMatrix.dataSize, sizeof(double));
751 }
752#endif
753
754 return 0;
755}
756
757
758// void Send(Matrix &):

Callers

nothing calls this directly

Calls 3

cleanup_socketsFunction · 0.70
byte_swapFunction · 0.70
getTypeMethod · 0.45

Tested by

no test coverage detected