]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
move code to the right place
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 20 Oct 2008 16:33:46 +0000 (16:33 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 20 Oct 2008 16:33:46 +0000 (16:33 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10083 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index 8d9e9fa3acddc8ebed29ba9f347c0361236c5cf0..b8b1d030d85b751f87329cd97e00b48ff641693b 100644 (file)
@@ -619,18 +619,6 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                }
        }
 
-       if (listener->sock && listener->hup) {
-               char content_buf[512] = "";
-               const char message[] = "Disconnected, goodbye!\nSee you at ClueCon http://www.cluecon.com!\n";
-               int message_len = strlen(message);
-               
-               switch_snprintf(content_buf, sizeof(content_buf), "Content-Type: text/disconnect-notice\nContent-Length %d\n\n", message_len);
-               len = strlen(content_buf);
-               switch_socket_send(listener->sock, content_buf, &len);
-               len = message_len;
-               switch_socket_send(listener->sock, message, &len);
-       }
-
        return status;
 
 }
@@ -1307,8 +1295,21 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n");
 
        switch_thread_rwlock_wrlock(listener->rwlock);
+       
+       if (listener->sock) {
+               char buf[512] = "";
+               const char message[] = "Disconnected, goodbye!\nSee you at ClueCon http://www.cluecon.com!\n";
+               int mlen = strlen(message);
+               
+               switch_snprintf(buf, sizeof(buf), "Content-Type: text/disconnect-notice\nContent-Length %d\n\n", mlen);
+               len = strlen(buf);
+               switch_socket_send(listener->sock, buf, &len);
+               len = mlen;
+               switch_socket_send(listener->sock, message, &len);
+               close_socket(&listener->sock);
+       }
+
        switch_thread_rwlock_unlock(listener->rwlock);
-       close_socket(&listener->sock);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n");
        switch_core_hash_destroy(&listener->event_hash);