|
1 | 1 | /* |
2 | | - Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
| 2 | + Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify |
5 | 5 | it under the terms of the GNU General Public License as published by |
@@ -1914,25 +1914,26 @@ MgmApiSession::list_session(SocketServer::Session *_s, void *data) |
1914 | 1914 | if(s->m_ctx) |
1915 | 1915 | { |
1916 | 1916 | int l= (int)strlen(s->m_ctx->m_tokenBuffer); |
1917 | | - char *buf= (char*) malloc(2*l+1); |
1918 | | - char *b= buf; |
1919 | | - for(int i=0; i<l;i++) |
1920 | | - if(s->m_ctx->m_tokenBuffer[i]=='\n') |
1921 | | - { |
1922 | | - *b++='\\'; |
1923 | | - *b++='n'; |
1924 | | - } |
1925 | | - else |
1926 | | - { |
1927 | | - *b++= s->m_ctx->m_tokenBuffer[i]; |
1928 | | - } |
1929 | | - *b= '\0'; |
| 1917 | + lister->m_output->println("session.%llu.parser.buffer.len: %u", id, l); |
| 1918 | + lister->m_output->print("session.%llu.parser.buffer: ", id); |
| 1919 | + for (int i = 0; i < l; i++) |
| 1920 | + { |
1930 | 1921 |
|
1931 | | - lister->m_output->println("session.%llu.parser.buffer.len: %u",id,l); |
1932 | | - lister->m_output->println("session.%llu.parser.buffer: %s",id,buf); |
1933 | | - lister->m_output->println("session.%llu.parser.status: %d",id,s->m_ctx->m_status); |
| 1922 | + if (s->m_ctx->m_tokenBuffer[i] == '\n') |
| 1923 | + { |
| 1924 | + |
| 1925 | + lister->m_output->print("%s", "\\"); |
| 1926 | + lister->m_output->print("%c", 'n'); |
1934 | 1927 |
|
1935 | | - free(buf); |
| 1928 | + } |
| 1929 | + else |
| 1930 | + { |
| 1931 | + lister->m_output->print("%c", s->m_ctx->m_tokenBuffer[i]); |
| 1932 | + } |
| 1933 | + } |
| 1934 | + //listener reads line by line hence we are not using println till we print the complete message. |
| 1935 | + lister->m_output->println("%c","\0"); |
| 1936 | + lister->m_output->println("session.%llu.parser.status: %d",id,s->m_ctx->m_status); |
1936 | 1937 | } |
1937 | 1938 |
|
1938 | 1939 | if(s!=lister) |
|
0 commit comments