Lines Matching defs:connection

41  * front-end client; the back end interface assumes only a single connection.
307 waitForSpace(SharedMemoryConnection *connection, Stream *stream)
314 error = sysEventWait(connection->otherProcess, stream->hasSpace, 0);
316 CHECK_ERROR(enterMutex(stream, connection->shutdown));
335 waitForData(SharedMemoryConnection *connection, Stream *stream)
342 error = sysEventWait(connection->otherProcess, stream->hasData, 0);
344 CHECK_ERROR(enterMutex(stream, connection->shutdown));
483 freeConnection(SharedMemoryConnection *connection)
485 (*callback->free)(connection);
489 closeConnection(SharedMemoryConnection *connection)
492 * Signal all threads accessing this connection that we are
495 if (connection->shutdown) {
496 sysEventSignal(connection->shutdown);
500 (void)closeStream(&connection->outgoing, JNI_TRUE);
501 (void)closeStream(&connection->incoming, JNI_FALSE);
503 if (connection->sharedMemory) {
504 sysSharedMemClose(connection->sharedMemory, connection->shared);
506 if (connection->otherProcess) {
507 sysProcessClose(connection->otherProcess);
511 * Ideally we should close the connection->shutdown event and
512 * free the connection structure. However as closing the
513 * connection is asynchronous it means that other threads may
514 * still be accessing the connection structure. On Win32 this
515 * means we leak 132 bytes and one event per connection. This
518 * if (connection->shutdown)
519 * sysEventClose(connection->shutdown);
520 * freeConnection(connection);
535 SharedMemoryConnection *connection = allocConnection();
536 if (connection == NULL) {
540 sprintf(connection->name, "%s.%ld", transport->name, sysProcessGetID());
541 error = sysSharedMemOpen(connection->name, &connection->sharedMemory,
542 &connection->shared);
544 closeConnection(connection);
549 connection->incoming.shared = &connection->shared->toClient;
550 connection->outgoing.shared = &connection->shared->toServer;
552 error = openStream(&connection->incoming);
554 closeConnection(connection);
558 error = openStream(&connection->outgoing);
560 closeConnection(connection);
564 error = sysProcessOpen(otherPID, &connection->otherProcess);
567 closeConnection(connection);
572 * Create an event that signals that the connection is shutting
577 error = sysEventCreate(NULL, &connection->shutdown, JNI_TRUE);
580 closeConnection(connection);
584 *connectionPtr = connection;
599 SharedMemoryConnection *connection = allocConnection();
600 if (connection == NULL) {
604 sprintf(connection->name, "%s.%ld", transport->name, otherPID);
605 error = sysSharedMemCreate(connection->name, sizeof(SharedMemory),
606 &connection->sharedMemory, &connection->shared);
608 closeConnection(connection);
612 memset(connection->shared, 0, sizeof(SharedMemory));
615 connection->incoming.shared = &connection->shared->toServer;
616 connection->outgoing.shared = &connection->shared->toClient;
618 strcpy(streamPrefix, connection->name);
620 error = createStream(streamPrefix, &connection->incoming);
622 closeConnection(connection);
626 strcpy(streamPrefix, connection->name);
628 error = createStream(streamPrefix, &connection->outgoing);
630 closeConnection(connection);
634 error = sysProcessOpen(otherPID, &connection->otherProcess);
637 closeConnection(connection);
642 * Create an event that signals that the connection is shutting
647 error = sysEventCreate(NULL, &connection->shutdown, JNI_TRUE);
650 closeConnection(connection);
654 *connectionPtr = connection;
833 SharedMemoryConnection *connection;
840 &connection);
848 freeConnection(connection);
858 closeConnection(connection);
862 *connectionPtr = connection;
889 /* lock transport - no additional event to wait on as no connection yet */
924 shmemBase_closeConnection(SharedMemoryConnection *connection)
927 closeConnection(connection);
938 shmemBase_sendByte(SharedMemoryConnection *connection, jbyte data)
940 Stream *stream = &connection->outgoing;
946 CHECK_ERROR(enterMutex(stream, connection->shutdown));
947 CHECK_ERROR(waitForSpace(connection, stream));
963 shmemBase_receiveByte(SharedMemoryConnection *connection, jbyte *data)
965 Stream *stream = &connection->incoming;
971 CHECK_ERROR(enterMutex(stream, connection->shutdown));
972 CHECK_ERROR(waitForData(connection, stream));
988 sendBytes(SharedMemoryConnection *connection, const void *bytes, jint length)
990 Stream *stream = &connection->outgoing;
999 CHECK_ERROR(enterMutex(stream, connection->shutdown));
1001 CHECK_ERROR(waitForSpace(connection, stream));
1032 shmemBase_sendPacket(SharedMemoryConnection *connection, const jdwpPacket *packet)
1038 CHECK_ERROR(sendBytes(connection, &packet->type.cmd.id, sizeof(jint)));
1039 CHECK_ERROR(sendBytes(connection, &packet->type.cmd.flags, sizeof(jbyte)));
1042 CHECK_ERROR(sendBytes(connection, &packet->type.reply.errorCode, sizeof(jshort)));
1044 CHECK_ERROR(sendBytes(connection, &packet->type.cmd.cmdSet, sizeof(jbyte)));
1045 CHECK_ERROR(sendBytes(connection, &packet->type.cmd.cmd, sizeof(jbyte)));
1050 CHECK_ERROR(sendBytes(connection, &data_length, sizeof(jint)));
1053 CHECK_ERROR(sendBytes(connection, packet->type.cmd.data, data_length));
1060 receiveBytes(SharedMemoryConnection *connection, void *bytes, jint length)
1062 Stream *stream = &connection->incoming;
1071 CHECK_ERROR(enterMutex(stream, connection->shutdown));
1073 CHECK_ERROR(waitForData(connection, stream));
1102 shmemBase_receivePacket(SharedMemoryConnection *connection, jdwpPacket *packet)
1109 CHECK_ERROR(receiveBytes(connection, &packet->type.cmd.id, sizeof(jint)));
1110 CHECK_ERROR(receiveBytes(connection, &packet->type.cmd.flags, sizeof(jbyte)));
1113 CHECK_ERROR(receiveBytes(connection, &packet->type.reply.errorCode, sizeof(jshort)));
1115 CHECK_ERROR(receiveBytes(connection, &packet->type.cmd.cmdSet, sizeof(jbyte)));
1116 CHECK_ERROR(receiveBytes(connection, &packet->type.cmd.cmd, sizeof(jbyte)));
1119 CHECK_ERROR(receiveBytes(connection, &data_length, sizeof(jint)));
1133 error = receiveBytes(connection, packet->type.cmd.data, data_length);