Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
8a48c9e6
Commit
8a48c9e6
authored
9 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_http_websocket: Debug write lengths."
parents
7351d33a
c63316ee
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
res/ari/ari_websockets.c
+1
-1
1 addition, 1 deletion
res/ari/ari_websockets.c
res/res_http_websocket.c
+23
-0
23 additions, 0 deletions
res/res_http_websocket.c
with
24 additions
and
1 deletion
res/ari/ari_websockets.c
+
1
−
1
View file @
8a48c9e6
...
@@ -174,7 +174,7 @@ int ast_ari_websocket_session_write(struct ast_ari_websocket_session *session,
...
@@ -174,7 +174,7 @@ int ast_ari_websocket_session_write(struct ast_ari_websocket_session *session,
return
-
1
;
return
-
1
;
}
}
ast_debug
(
3
,
"Examining ARI event
:
\n
%s
\n
"
,
str
);
ast_debug
(
3
,
"Examining ARI event
(length %zu):
\n
%s
\n
"
,
strlen
(
str
)
,
str
);
if
(
ast_websocket_write_string
(
session
->
ws_session
,
str
))
{
if
(
ast_websocket_write_string
(
session
->
ws_session
,
str
))
{
ast_log
(
LOG_NOTICE
,
"Problem occurred during websocket write, websocket closed
\n
"
);
ast_log
(
LOG_NOTICE
,
"Problem occurred during websocket write, websocket closed
\n
"
);
return
-
1
;
return
-
1
;
...
...
This diff is collapsed.
Click to expand it.
res/res_http_websocket.c
+
23
−
0
View file @
8a48c9e6
...
@@ -300,6 +300,24 @@ int AST_OPTIONAL_API_NAME(ast_websocket_close)(struct ast_websocket *session, ui
...
@@ -300,6 +300,24 @@ int AST_OPTIONAL_API_NAME(ast_websocket_close)(struct ast_websocket *session, ui
return
res
;
return
res
;
}
}
static
const
char
*
opcode_map
[]
=
{
[
AST_WEBSOCKET_OPCODE_CONTINUATION
]
=
"continuation"
,
[
AST_WEBSOCKET_OPCODE_TEXT
]
=
"text"
,
[
AST_WEBSOCKET_OPCODE_BINARY
]
=
"binary"
,
[
AST_WEBSOCKET_OPCODE_CLOSE
]
=
"close"
,
[
AST_WEBSOCKET_OPCODE_PING
]
=
"ping"
,
[
AST_WEBSOCKET_OPCODE_PONG
]
=
"pong"
,
};
static
const
char
*
websocket_opcode2str
(
enum
ast_websocket_opcode
opcode
)
{
if
(
opcode
<
AST_WEBSOCKET_OPCODE_CONTINUATION
||
opcode
>
AST_WEBSOCKET_OPCODE_PONG
)
{
return
"<unknown>"
;
}
else
{
return
opcode_map
[
opcode
];
}
}
/*! \brief Write function for websocket traffic */
/*! \brief Write function for websocket traffic */
int
AST_OPTIONAL_API_NAME
(
ast_websocket_write
)(
struct
ast_websocket
*
session
,
enum
ast_websocket_opcode
opcode
,
char
*
payload
,
uint64_t
actual_length
)
int
AST_OPTIONAL_API_NAME
(
ast_websocket_write
)(
struct
ast_websocket
*
session
,
enum
ast_websocket_opcode
opcode
,
char
*
payload
,
uint64_t
actual_length
)
...
@@ -308,6 +326,9 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write)(struct ast_websocket *session, en
...
@@ -308,6 +326,9 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write)(struct ast_websocket *session, en
char
*
frame
;
char
*
frame
;
uint64_t
length
;
uint64_t
length
;
ast_debug
(
3
,
"Writing websocket %s frame, length %"
PRIu64
"
\n
"
,
websocket_opcode2str
(
opcode
),
actual_length
);
if
(
actual_length
<
126
)
{
if
(
actual_length
<
126
)
{
length
=
actual_length
;
length
=
actual_length
;
}
else
if
(
actual_length
<
(
1
<<
16
))
{
}
else
if
(
actual_length
<
(
1
<<
16
))
{
...
@@ -1372,6 +1393,8 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write_string)
...
@@ -1372,6 +1393,8 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write_string)
{
{
uint64_t
len
=
strlen
(
buf
);
uint64_t
len
=
strlen
(
buf
);
ast_debug
(
3
,
"Writing websocket string of length %"
PRIu64
"
\n
"
,
len
);
/* We do not pass strlen(buf) to ast_websocket_write() directly because the
/* We do not pass strlen(buf) to ast_websocket_write() directly because the
* size_t returned by strlen() may not require the same storage size
* size_t returned by strlen() may not require the same storage size
* as the uint64_t that ast_websocket_write() uses. This normally
* as the uint64_t that ast_websocket_write() uses. This normally
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment