Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevents multiple definition linker errors #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions wsclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@
#include "config.h"
#include "sha1.h"

int libwsclient_flags = 0;

const char *errors[] = {
"Unknown error occured",
"Error while getting address info",
"Could connect to any address returned by getaddrinfo",
"Error receiving data in client run thread",
"Error during libwsclient_close",
"Error sending while handling control frame",
"Received masked frame from server",
"Got null pointer during message dispatch",
"Attempted to send after close frame was sent",
"Attempted to send during connect",
"Attempted to send null payload",
"Attempted to send too much data",
"Error during send in libwsclient_send",
"Remote end closed connection during handshake",
"Problem receiving data during handshake",
"Remote web server responded with bad HTTP status during handshake",
"Remote web server did not respond with upgrade header during handshake",
"Remote web server did not respond with connection header during handshake",
"Remote web server did not specify the appropriate Sec-WebSocket-Accept header during handshake",
NULL
};

void libwsclient_run(wsclient *c) {
if(c->flags & CLIENT_CONNECTING) {
Expand Down
29 changes: 3 additions & 26 deletions wsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,8 @@ void libwsclient_close(wsclient *c);
int libwsclient_helper_socket(wsclient *c, const char *path);
void *libwsclient_helper_socket_thread(void *ptr);

//Define errors
char *errors[] = {
"Unknown error occured",
"Error while getting address info",
"Could connect to any address returned by getaddrinfo",
"Error receiving data in client run thread",
"Error during libwsclient_close",
"Error sending while handling control frame",
"Received masked frame from server",
"Got null pointer during message dispatch",
"Attempted to send after close frame was sent",
"Attempted to send during connect",
"Attempted to send null payload",
"Attempted to send too much data",
"Error during send in libwsclient_send",
"Remote end closed connection during handshake",
"Problem receiving data during handshake",
"Remote web server responded with bad HTTP status during handshake",
"Remote web server did not respond with upgrade header during handshake",
"Remote web server did not respond with connection header during handshake",
"Remote web server did not specify the appropriate Sec-WebSocket-Accept header during handshake",
NULL
};

int libwsclient_flags; //global flags variable

#if !defined(libwsclient_flags)
extern int libwsclient_flags; //global flags variable
#endif

#endif /* WSCLIENT_H_ */