event: move buffer size to a macro
Move buffer size for incoming messages to a macro. So it can be changed in one place.
This commit is contained in:
@@ -57,6 +57,9 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
|
/** Max buffer size for receiving messages. */
|
||||||
|
#define STROPE_MESSAGE_BUFFER_SIZE 4096
|
||||||
|
|
||||||
/** Run the event loop once.
|
/** Run the event loop once.
|
||||||
* This function will run send any data that has been queued by
|
* This function will run send any data that has been queued by
|
||||||
* xmpp_send and related functions and run through the Strophe even
|
* xmpp_send and related functions and run through the Strophe even
|
||||||
@@ -80,7 +83,7 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
xmpp_send_queue_t *sq, *tsq;
|
xmpp_send_queue_t *sq, *tsq;
|
||||||
int towrite;
|
int towrite;
|
||||||
char buf[4096];
|
char buf[STROPE_MESSAGE_BUFFER_SIZE];
|
||||||
uint64_t next;
|
uint64_t next;
|
||||||
uint64_t usec;
|
uint64_t usec;
|
||||||
int tls_read_bytes = 0;
|
int tls_read_bytes = 0;
|
||||||
@@ -260,9 +263,9 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
|
|||||||
case XMPP_STATE_CONNECTED:
|
case XMPP_STATE_CONNECTED:
|
||||||
if (FD_ISSET(conn->sock, &rfds) || (conn->tls && tls_pending(conn->tls))) {
|
if (FD_ISSET(conn->sock, &rfds) || (conn->tls && tls_pending(conn->tls))) {
|
||||||
if (conn->tls) {
|
if (conn->tls) {
|
||||||
ret = tls_read(conn->tls, buf, 4096);
|
ret = tls_read(conn->tls, buf, STROPE_MESSAGE_BUFFER_SIZE);
|
||||||
} else {
|
} else {
|
||||||
ret = sock_read(conn->sock, buf, 4096);
|
ret = sock_read(conn->sock, buf, STROPE_MESSAGE_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user