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

LibEvent-based socket API #1701

Merged
merged 34 commits into from Jan 24, 2015
Merged

LibEvent-based socket API #1701

merged 34 commits into from Jan 24, 2015

Conversation

madmaxoft
Copy link
Member

DO NOT MERGE YET!

This is a work-in-progress to implement a LibEvent-based socket API that both the C++ part and Lua plugins could use. The PR has been created as a platform for (early) code review; for discussion please use the forum thread:
http://forum.mc-server.org/showthread.php?tid=1700

Will fix #1352

@madmaxoft madmaxoft force-pushed the libevent branch 6 times, most recently from c0fa329 to 4af6e8c Compare January 13, 2015 11:55
@madmaxoft
Copy link
Member Author

I think this is now ready for a major review - is this API sufficient, does it perform well, and is it documented enough?

/** Returns true if the server has been started correctly and is currently listening for incoming connections. */
virtual bool IsListening(void) const = 0;
};
typedef SharedPtr<cServerHandle> cServerHandlePtr;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary for this to be a shared_ptr rather than a unique_ptr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instance is returned by the cNetwork::Listen() function and is also stored within the cNetworkSingleton class.

@madmaxoft
Copy link
Member Author

Shall we merge now and open a new PR for the actual rewrite of the server internals (so that the Lua API can be developed in parallel in a separate PR)?

@NiLSPACE
Copy link
Member

I agree for a merge.

@madmaxoft
Copy link
Member Author

After reading the cServer code for a while, I think the API is not good yet. (more in the forum)

madmaxoft and others added 22 commits January 22, 2015 20:12
This is mainly for WinXP and RasPi testing.
avoidss unused variable error in clang
The callback receives the error details.
The link-callbacks for each new accepted link are now received from the OnIncomingConnection listen-callback.
This allows the callback classes to store the link inside them and use it internally later on, mainly for sending data.
madmaxoft added a commit that referenced this pull request Jan 24, 2015
@madmaxoft madmaxoft merged commit f91de20 into master Jan 24, 2015
@madmaxoft madmaxoft deleted the libevent branch February 7, 2015 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement a high-level "server" and "client" class abstractions.
3 participants