Hopefully fixed the double log bug that causes so much trouble.
[lcr.git] / chan_lcr.c
index a681e79..38f969b 100644 (file)
@@ -1264,6 +1264,7 @@ int receive_message(int message_type, unsigned int ref, union parameter *param)
        if (message_type == MESSAGE_BCHANNEL) {
                switch(param->bchannel.type) {
                        case BCHANNEL_ASSIGN:
+lock_debug("rx1");
                        CDEBUG(NULL, NULL, "Received BCHANNEL_ASSIGN message. (handle=%08lx) for ref %d\n", param->bchannel.handle, ref);
                        if ((bchannel = find_bchannel_handle(param->bchannel.handle))) {
                                CERROR(NULL, NULL, "bchannel handle %x already assigned.\n", (int)param->bchannel.handle);
@@ -1531,13 +1532,18 @@ static int handle_socket(struct lcr_fd *fd, unsigned int what, void *instance, i
        lock_debug("handle+");
        if ((what & LCR_FD_READ)) {
                /* read from socket */
+               lock_debug("handle1");
                len = read(lcr_sock, &msg, sizeof(msg));
+               lock_debug("handle2");
                if (len == 0) {
                        CERROR(NULL, NULL, "Socket closed.\n");
                        error:
                        CERROR(NULL, NULL, "Handling of socket failed - closing for some seconds.\n");
+                       lock_debug("handle3");
                        close_socket();
+                       lock_debug("handle4");
                        release_all_calls();
+                       lock_debug("handle5");
                        schedule_timer(&socket_retry, SOCKET_RETRY_TIMER, 0);
                        lock_debug("handle-");
                        return 0;
@@ -1551,7 +1557,9 @@ static int handle_socket(struct lcr_fd *fd, unsigned int what, void *instance, i
                                CERROR(NULL, NULL, "Socket received illegal message %d.\n", msg.message);
                                goto error;
                        }
+                       lock_debug("handleX");
                        receive_message(msg.u.msg.type, msg.u.msg.ref, &msg.u.msg.param);
+                       lock_debug("handleY");
                } else {
                        CERROR(NULL, NULL, "Socket failed (errno %d).\n", errno);
                        goto error;
@@ -1565,8 +1573,10 @@ static int handle_socket(struct lcr_fd *fd, unsigned int what, void *instance, i
                        lock_debug("handle-");
                        return 0;
                }
+               lock_debug("handle6");
                admin = admin_first;
                len = write(lcr_sock, &admin->msg, sizeof(msg));
+               lock_debug("handle7");
                if (len == 0) {
                        CERROR(NULL, NULL, "Socket closed.\n");
                        goto error;
@@ -1577,6 +1587,7 @@ static int handle_socket(struct lcr_fd *fd, unsigned int what, void *instance, i
                                goto error;
                        }
                        /* free head */
+                       lock_debug("handle8");
                        admin_first = admin->next;
                        free(admin);
                        global_change = 1;
@@ -1681,7 +1692,7 @@ static void handle_queue()
                ast = call->ast;
                if (*p && ast) {
                        lock_debug("A1+");
-                       ast_channel_lock(ast);
+//                     ast_channel_lock(ast);
                        lock_debug("A1-");
                        while(*p) {
                                switch (*p) {
@@ -1738,7 +1749,7 @@ static void handle_queue()
                                p++;
                        }
                        call->queue_string[0] = '\0';
-                       ast_channel_unlock(ast);
+//                     ast_channel_unlock(ast);
                        lock_debug("a1");
                }
                call = call->next;